AncestryChanged (Event): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>NXTBoy used anonymous function to simplify code. |
>Flurite No edit summary |
||
Line 7: | Line 7: | ||
{{clear floats}} | {{clear floats}} | ||
{{Example|< | {{Example|<code lua> | ||
local p = Instance.new("Part") | local p = Instance.new("Part") | ||
p.Parent = game.Workspace | p.Parent = game.Workspace | ||
Line 14: | Line 14: | ||
end) | end) | ||
p.Parent = game.Lighting --fires event | p.Parent = game.Lighting --fires event | ||
</ | </code>}} | ||
==Notes== | ==Notes== |
Revision as of 02:08, 25 March 2012
AncestryChanged ( Instance child, Instance parent ) | |
Description | Fired when an ancestor of the Instance the event is a member of (child) has its parent changed to parent. |
---|---|
Member of: | Instance |
Example
{{{1}}}
Notes
- child can be the object the event is a member of, or any of its ancestors. For example, if a Part is a child of a Model and the Model's parent is changed to Lighting, AncestryChanged would be fired on the Part with child being the Model and parent being Lighting.
- parent can be nil. This event can be used to see when an Instance is removed from the game by testing if parent is nil.