Cloning gear and putting it into player's backpack

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

Is this the whole script? Based on my perspective, it should only one per player.

No, this is not the whole script. Just the part that clones the gear.

My theory is that you have another loop or you have another variable that has the name “player”.

Oh, so I do have another variable named “player”. Let me rename it and see what happens.

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.

Maybe you’re actually right because there’s no while true do loop or anything so it might be “player” or something

local Sword = game.ServerStorage.ClassicSword

for _, p in pairs(Players:GetPlayers()) do
	delay(5,function()
		Sword:Clone().Parent = p.Backpack
	end)
end

Where is this script? And how does it get initiated to run?