Detecting if a child moves?

Howdy, just wondering what would the easiest way for me to detect if a child from one folder changes to another. Probably easier to explain with a diagram.

I’m essentially attempting to listen to User_xg1y (in this diagram) and call a function if a child from one folder moves to another. eg;
image

Whats the best solution for this?

Would appreciate any assistance in this situation.
Thanks

1 Like

Try:

Item:GetPropertyChangedSignal("Parent"):Connect(function()
    print(Item.Parent) -- New Folder
end)

EDIT: Item.Changed works too but I like the GetPropertyChangedSignal() better.

4 Likes

The objects have the “AncestryChanged” event.

1 Like

Doesn’t fire when a change occurs man, pretty sure thats to detect when a child is destroyed or deleted.

I’ll go test it real quick, but it should still detect the object moving, because the ancestry is going to change when it’s parent changes.

It does fire when change occurs. That’s literally how the method works. Just went and tested it to prove it.

game.Workspace.Part.AncestryChanged:Connect(function(child, parent)
	print(child,child.Parent)
    print(parent,parent.Parent)
end);
4 Likes

what if i wanted to detect if the children and not the parent changed?