Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would the person only get one item?

Asked by 9 years ago
for i, player in ipairs(game.Players:GetChildren()) do
SS.SWeps.Sword:clone().Parent = player.Backpack
    end

When this piece of code runs people get 2 swords instead of 1. How would I fix this?

1 answer

Log in to vote
0
Answered by 9 years ago
for i, player in pairs(game.Players:GetChildren()) do
if player:FindFirstChild("Backpack")
then
SS.SWeps.Sword:clone().Parent = player:FindFirstChild("Backpack")
end
end

Ad

Answer this question