local Players = { --List of players who get the sword ['Player1'] = true, ['Player2' = true, ['Player3'] = true } Game.Players.PlayerAdded:connect(function(Player) if Players[Player.Name] then Game.ReplicatedStorage.Sword:Clone().Parent = Player:WaitForChild('Backpack') --Make sure the sword name is "Sword" inside of ReplicatedStorage end end)
idk why it wont work
The script works fine, but you're missing a closing ]
on line 3 after 'Player2'
. The complete script is here:
local Players = { --List of players who get the sword ['Player1'] = true, ['Player2'] = true, ['Player3'] = true } Game.Players.PlayerAdded:connect(function(Player) if Players[Player.Name] then Game.ReplicatedStorage.Sword:Clone().Parent = Player:WaitForChild('Backpack') --Make sure the sword name is "Sword" inside of ReplicatedStorage end end)
If you check the output in Studio, you can catch such errors along with a line number and (brief) description of what's wrong. That will help you in your debugging efforts.