Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

A script meant to do something to everyone in a team only does it for one player?

This script is a countdown for when a round begins. At the end of the countdown, it is supposed to give all the players teamed 'Fighters' a sword. However, it only gives it to one player, any ideas why?

wait(5)
sword = game.ServerStorage.Sword:Clone()
for i = 10,0,-1 do
	wait(1.2)
	local text = "Good luck! The round is starting in: " ..i
	game.ReplicatedStorage.cd:FireAllClients(text, i)
	print(i .. "XDXDXD")

	if i == 0 then 
game.Workspace.songg.SoundId = "http://www.roblox.com/asset/?id=1842263532"
game.Workspace.songg:Play()
		
for i,v in pairs(game.Teams.Fighters:GetPlayers()) do
				sword.Parent = v.Backpack
			end


		game.ServerScriptService.gamecd.Disabled = false
		lol = true
		game.ReplicatedStorage.roundd.Value = game.ReplicatedStorage.roundd.Value + 1
script.Parent.round.Disabled = true
script.Disabled = true
	end
end


This is the part of the script that does the giving:

for i,v in pairs(game.Teams.Fighters:GetPlayers()) do
				sword.Parent = v.Backpack
			end

1 answer

✓ Accepted answer

Because you only cloned one sword. You need to clone one for each player.

for i,v in pairs(game.Teams.Fighters:GetPlayers()) do
    local sword = game.ServerStorage.Sword:Clone()
    sword.Parent = v.Backpack
end

This discussion is preserved as it was. New answers, comments, and votes are closed.