Garry's Mod Wiki


  Entity:SetParent( Entity parent = NULL, number attachmentId = -1 )


Sets the parent of this entity, making it move with its parent. This will make the child entity non solid, nothing can interact with them, including traces.

This does not work on the world.
This can cause undefined physics behaviour when used on entities that don't support parenting. See the Valve developer wiki for more information.


1 Entity parent = NULL
The entity to parent to. Setting this to nil will clear the parent.
2 number attachmentId = -1
The attachment id to use when parenting, defaults to -1 or whatever the parent had set previously.
You must call Entity:SetMoveType( MOVETYPE_NONE ) on the child for this argument to have any effect!