I’m making a sword fighting game, and when I want to clone the sword into the player’s backpack, for some reason it clones several times. This is my code.
local Sword = game.ServerStorage.ClassicSword
for _,player in pairs(Players:GetPlayers()) do
wait(5)
Sword:Clone().Parent = player.Backpack
end
The Sword clones for every player inside the game for example say there’s 5 players the Sword is going to clone 5 times. I would recommend doing this :
local AllPlayers = Players:GetPlayers()
for i = 1, #AllPlayers do
wait(5)
Sword:Clone().Parent = AllPlayers[i].Backpack
end
Actually his script says that “Hey, loop though all the player and give each one”. Your method also works, but doesn’t solve and explain his problem looping everytime.