Is Roblox not processing my code?

For about 30 minutes I’ve been testing this code, and checking the output, but it seems to not output anything.

local Event = game.ReplicatedStorage:WaitForChild("Events")
local Maps = game.ReplicatedStorage:WaitForChild("Maps")
local Bindables = game.ReplicatedStorage:WaitForChild("BindableEvents")
local Players = game.Players:GetPlayers()

while true do
	
	wait()
	
	x = 0
	
	for i,v in pairs(Players) do
		
		print("Looping...")
		x = x + 1
		v.CharacterAdded:wait()
		
	end
	
	if x >= 3 then
		
		print("Three players!")
		Bindables:WaitForChild("StartGame"):Fire()
		
	end
	
end

Does anyone see any errors?

2 Likes

Players is an empty table when the Server starts, so it never loops.

Replace pairs(Players) with pairs(game.Players:GetPlayers())

4 Likes

It would actually be smarter to use the :GetService() function for players in case the service were renamed or there was client code and the exploiter renamed the service locally.

2 Likes