how do i add like a sword to my starter pack to where only certain players can get it
✓ ANSWER ACCEPTED
how do i add like a sword to my starter pack to where only certain players can get it?
2 answers
✓ Accepted answer
A PlayerAdded and CharacterAdded events are needed to do this. Script
game.Players.PlayerAdded:connect(function(plr) -- playeradded event identifying the player that joined as "plr"
plr.CharacterAdded:connect(function(char) -- characteradded event, identifying the plr's character that respawned as "char"
if plr.Name == "NameHere" then -- Change "NameHere" to the player that has the permission to have the tool.
local tool = game.ServerStorage.Tool:Clone() -- cloning the tool from serverstorage, change this to your parenting
local backpack = plr:findFirstChild("Backpack") -- getting the player's backpack
if backpack then -- checking if the backpack exists to prevent possible errors(not necessary)
tool.Parent = backpack -- parenting it to their backpack.
end
end
end)
end)
Full Script:
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
if plr.Name == "NameHere" then
local tool = game.ServerStorage.Tool:Clone()
local backpack = plr:findFirstChild("Backpack")
if backpack then
tool.Parent = backpack
end
end
end)
end)
Hope it helped!
game.Players.PlayerAdded:connect(function(plr) -- playeradded event identifying the player that joined as "plr"
plr.CharacterAdded:connect(function(char) -- characteradded event, identifying the plr's character that respawned as "char"
if plr.Name == "ags5321" then -- Change "NameHere" to the player that has the permission to have the tool.
local tool = game.ServerStorage:Clone("Card1") -- cloning the tool from serverstorage, change this to your parenting
local backpack = plr:findFirstChild("Backpack") -- getting the player's backpack
if backpack then -- checking if the backpack exists to prevent possible errors(not necessary)
tool.Parent = backpack -- parenting it to their backpack.
end
end
end)
end)
is that it
This discussion is preserved as it was. New answers, comments, and votes are closed.

8 comments
where do i put that just in work space?
im confused on line 4
Put the tool under ServerStorage, and name it "Tool"
I made a mistake on line 4 because I was typing really fast and was in a hurry, but I just fixed it.
Ok where do I but the tool name
Ok where do I but the tool name
You replace "Tool" on line 4 with the tool name.
Ok where do I but the tool name