local Tools = {
["Assassins"] = game.ServerStorage.Tag,}
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
local NumItems = plr.Backpack:GetChildren()
plr.Changed:connect(function()
if #NumItems > 0 then
return
end
if plr.Team == game.Teams.Assassins then
wait(2)
Tools.Assassins:Clone().Parent = plr:WaitForChild("Backpack")
end
end)
end)
end)
✓ ANSWER ACCEPTED
why is my script giving the player 2 tools instead of 1?
1 answer
✓ Accepted answer
My guess would be that multiple properties are changing when this is happening, giving you multiple tools. Two things we could do to fix and improve this are to first, check that the tool we are putting into the backpack doesn't already exist using logic. We can also only fire the event when the player's team is changed instead of when any property of the player is changed.
local Tools = {
["Assassins"] = game.ServerStorage.Tag,}
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
local NumItems = plr.Backpack:GetChildren()
plyr:GetPropertyChangedSignal("Team"):connect(function() -- changed this to the property change signal of team
if #NumItems > 0 then
return
end
if plr.Team == game.Teams.Assassins and not(plr:WaitForChild("Backpack"):FindFirstChild("Assasins")) then -- check to see if the tool is already in the the backpack
wait(2)
Tools.Assassins:Clone().Parent = plr:WaitForChild("Backpack")
end
end)
end)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks so much it works perfectly now :)