This script is meant to clone a tool into a player with a specified userId. But it doesn't work. No output errors too!
newPlayer = game.Players.LocalPlayer if newPlayer.userId == 32441993 or newPlayer.userId == 36491121 or newPlayer.userId == 37983438 then a = game.Lighting:WaitForChild("Admin") if a ~= nil then backpack = newPlayer:WaitForChild("Backpack") if backpack ~= nil then a:Clone() a.Parent = backpack end end end
When you use WaitForChild, there is no point in checking to see if it returns nil -- it won't return until it has a non-nil value.
To debug, use print statements to see if the script is even running and what it executes:
print("begin") newPlayer = game.Players.LocalPlayer print("player", newPlayer, "id:", newplayer.userId) if newPlayer.userId == 32441993 or newPlayer.userId == 36491121 or newPlayer.userId == 37983438 then print("user is admin") a = game.Lighting:WaitForChild("Admin") print("game.Lighting.Admin returned", a) backpack = newPlayer:WaitForChild("Backpack") print("backpack:", backpack) a:Clone() a.Parent = backpack print("gave admin to player") end end end print("done")
One error I see is that you call "a:Clone()" but then you don't use the clone. This error wouldn't cause a syntax error, it'd just move the Admin from the lighting to the newest player, meaning that the script would appear to work the first time, but not the 2nd. You could do a:Clone().Parent = backpack
instead.