Problem with getting players in game.Players

Hello, fellow programmers, I’m having an issue with the number of players in the server from a script!

Script location: ServerScriptService
Errors: nil

--// Services
local PlayerService = game:GetService("Players")

--// Varaibles
local Cooldown = 60
local PlayerCount = 0

while wait(Cooldown) do
	local Players = PlayerService:GetChildren()
	
	for i = 1, #Players do 
		print("Player Found")
		PlayerCount += 1
	end
	
end

Try using PlayerService:GetPlayers()

I’m not completely sure but i think you can use game.Players:GetPlayers()

1 Like