Garry's Mod Wiki

Revision Difference

Entity:SetParent#528598

<function name="SetParent" parent="Entity" type="classfunc"> <description> Sets the parent of this entity, making it move with its parent. 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. <note>This does not work on <page text="the world">game.GetWorld</page>.</note> <warning>This can cause undefined physics behaviour when used on entities that don't support parenting. See the [Valve developer wiki](https://developer.valvesoftware.com/wiki/Entity_Hierarchy_(parenting)) for more information.</warning> </description> <realm>Shared</realm> <args> <arg name="parent" type="Entity" default="NULL">The entity to parent to. Setting this to nil will clear the parent.</arg> <arg name="attachmentId" type="number" default="-1">The attachment id to use when parenting, defaults to -1 or whatever the parent had set previously. <note>You must call <page>Entity:SetMoveType</page>( MOVETYPE_NONE ) on the child for this argument to have any effect!</note></arg> </args> </function>