Garry's Mod Wiki

Revision Difference

Entity:SetParent#517589

<function name="SetParent" parent="Entity" type="classfunc"> <description> Sets the parent of this entity, making it move with its parent. <note>This does not work on [the world](/gmod/game/GetWorld).</note> <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.&#xA;&#xA;&#xA;&lt;note&gt;You must call &lt;page&gt;Entity:SetMoveType&lt;/page&gt;( MOVETYPE_NONE ) on the child for this argument to have any effect!&lt;/note&gt;</arg> </args> </function>