Help with TD "money per wave" system

so, i have a TD wave system working perfectly. But, when try to give money to every player in the server, it only gives it to one person. this is part of my wave script.


task.wait(10)
for wave = 1,10 do
	print("wave "..wave.." starting")
	if wave == 1 then
		mob.Spawn("NormalZombie", 3, map)
	elseif wave == 2 then
		mob.Spawn("NormalZombie", 4, map)
	elseif wave == 3 then
		mob.Spawn("NormalZombie", 5, map)
	elseif wave == 4 then
		mob.Spawn("NormalZombie", 6, map)
	elseif wave == 5 then
		mob.Spawn("SwiftZombie", 4, map)
	elseif wave > 5 then
		moneyPerWave = 75
		mob.Spawn("NormalZombie", 8, map)
		mob.Spawn("SwiftZombie", 3, map)
		mob.Spawn("TankyZombie", 4, map)
	end
	
	repeat 
		task.wait(1)
	until #workspace.Mobs:GetChildren() == 0 or gameOver
	
	if gameOver then
		print("game ended")
		break
	end
	
	print("wave "..wave.." ending")
	for i, plrs in ipairs(game.Players:GetPlayers()) do
		plrs.leaderstats.Money.Value += moneyPerWave
		break
	end
	task.wait(1)
end
1 Like

because youre breaking the loop after giving it to one player, just remove the break and it should work

3 Likes

remove the break when looping through

for i, plrs in ipairs(game.Players:GetPlayers()) do
	plrs.leaderstats.Money.Value += moneyPerWave
end
1 Like

I was pretty sure it didnt give me my money after the second wave. I probably just didnt notice.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.