• Parenting players not working?
    7 replies, posted
For some reason my script [lua] ply:SetParent(self.Entity) ply:SetPos(self.Entity:GetPos()) [/lua] doesn't seem to actually parent the player. The player just gets teleported somewhere on the map and can still move. I know this is supposed to work because I made a vehicle script with this exact chunk of code , that worked. Was something changed since the last time I made something like this? Or am I just stupid and missed something?
Why would you set the position after parenting, that wouldn't do anything. And 2 lines of code isnt enoguh to see what's going on.
Answer 1 : simple , i don't want the player to be parented to the side of the entity but smack-dad in the middle of it , thus SetPos... Answer 2 : That is basically all that's going on so far in this script of mine. I don't make the whole entity only to find out SOMETHING went wrong , i do it piece by piece and fix the issues as they arise.
So , any theories as to why the player isn't actually being parented? Or are players just unable to get parented to things.
Parent the player after setting the position.
Still nothing , it's still not actually preventing the player from moving. Any way to cancel the calcview on the Player:SetScriptedVehicle( [URL="http://wiki.garrysmod.com/?title=Vehicle"]Vehicle[/URL] Vehicle )[B] [/B]function?
ply:Freeze( true ) will freeze the player. You cant parent players you can only parent too them. Don't use parent it is horrible at handling physics. [url]http://wiki.garrysmod.com/?title=Entity.SetParent[/url]
You could also use [lua] ply:Lock() [/lua] Use this if you want the player to be locked after they die (and respawn).
Sorry, you need to Log In to post a reply to this thread.