Understanding this For Loop

I’ve been checking out RottenV’s last released zombiespawner.lua (and all the other spawners). I got everything working by removing this for loop, but I want to know why this loop is here and what exactly it does.

Basically the script as-is never gets into this for loop. I’m assuming because the table players is empty? I have little coding knowledge, I’m just making guesses and wondered if someone could explain it. The script begins with:

players = {}

RegisterNetEvent("Z:playerUpdate")
AddEventHandler("Z:playerUpdate", function(mPlayers)
	players = mPlayers
end)

and loads fine up to this point.

				for _, player in pairs(players) do
					Wait(1)

				end

I’m just trying to understand the significance and whether or not I truly need this in a spawning script.

That loop pretty much just sets the wait time each time a player is looped through.

Ahhhh I see I see. Any clue why it wont go into the loop?

I’ve placed debugging traces outside of the for loop and inside it and it never reaches the inside.

Probably any mistake in the code before, I had a similar problem some time ago. Check the Code for mistakes

If the players table is empty then yes, it will technically never reach the loop as there’s nothing to iterate through. Sorry, posted my initial response when I first woke up and missed that question. lol