Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

ChildAdded need help?

Asked by
qwrn12 85
8 years ago

im trying to make it so thati can add a if statement into a instience child added but its not working what does work is

player.Backpack.ChildAdded:connect(function(instance)
    if (instance) then

    end
    print(instance.Name .. " added to the workspace")
end)

but thats not really mutch of a if statement im trying to make it so that child added and the name is not Baton then it would print that but i cant figure out how to do this

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
8 years ago

So, as I understand it, you're trying to check if the new instance's name is "Baton" then print.

Assuming player is defined, all you have to do is check if the Name Property of the new instance is equivelant to "Baton"


player.Backpack.ChildAdded:connect(function(instance)
    if instance.Name == "Baton" then
        print(instance.Name .. " added to the workspace")
    end
end)
Ad

Answer this question