I would like to print the newest child that has been added to a folder, but I don’t know how to do it
child added event, this is your solution
As Boustifail said, use Instance.ChildAdded to do it. You can have the script store the instance in a value or by other means.
Instance.ChildAdded:Connect()
is probably a better way to put it
https://developer.roblox.com/en-us/api-reference/event/Instance/ChildAdded
Well I would like to know what the name of the object that is added
Here is the example from the API:
workspace.ChildAdded:Connect(function(child)
-- need to use WaitForChild as descendants may not have replicated yet
local head = child:WaitForChild("Head")
end)
Note that this only matters if you do this on the client side.
Can’t you just do that on server side? I mean, it isn’t a function client only right?
– need to use WaitForChild as descendants may not have replicated yet
This only matters if it’s ran by the client, not the server.
Can’t you just do that on server side? I mean, it isn’t a function client only right?
This function can be used on both the server and client.
I mean, i just did copy paste the example from the API without checking it. But yes, you might need a line of code to wait for it.
Waiting (yielding) is only if the instance hasn’t been replicated to the client yet.
You do not need to wait if this function is handled on the server side.