So i tried to make a script where it would give me a keycard when I spawn, but it gives me an error what did i do wrong?
local players = {"CelticFury600"} local gear = game.ServerStorage.Keycard game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(chr) for i = 1, #players do if players[i] == plr.Name then gear:Clone().Parent = plr:WaitForChild("Backpack") end end end)
You forgot to add an end) for the playerAdded event. Since you haven't included it, that means that there's no end) for the event.
Alright, I tested the script, and I found the issue.
ISSUE:
You were missing an "end)" at the end of the script, ending the "PlayerAdded" function.
FIXED SCRIPT:
local players = {"CelticFury600"} --Change this to any name you want. If you want it to be any player, use "Game.Players:GetChildren()". local gear = game.ServerStorage.Keycard game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(chr) for i = 1, #players do if players[i] == plr.Name then gear:Clone().Parent = plr:WaitForChild("Backpack") end end end) end)
Hope this helped!
-Maxis_s