Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

i want only certain ppl t have the sword?

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

5 comments

0

Is there a sword in replicatedstorage?

0

yes

0

is it named "Sword"

0

Yes

0

Yes

1 answer

✓ Accepted answer

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.

1 comment

0

still doesnt work

This discussion is preserved as it was. New answers, comments, and votes are closed.