I don't know why it is making this error

can someone tell me why this gives an error?

   while true do
    	local players game.Players:GetChildren() -- this returns nil why? i have tried waiting so that is not the problem
    	for i, plr in ipairs(players) do
    		local stats = plr.stats
    		local money = stats.money
    		money.Value = tostring(tonumber(money.Value) + 1)

Your forgetting the equal sign and also use the GetPlayers method for retrieving all the players currently in the server.

--this line
local players game.Players:GetChildren()
--should be this:
local players = game.Players:GetPlayers()

oh i did i not see i was missing the = and thanks for letting me know that it is better to use :GetPlayers()

1 Like