Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to fix this error, Didn't had it until restarted?

Hi, so i got this error and idk what the hell is going on since i never had this error

error: ServerScriptService.leaderstats:84: attempt to index nil with 'UserId'

game:BindToClose(function(player)
	for _, Player in pairs(game.Players:GetPlayers()) do
		local playerUserId = "player_"..player.UserId

1 comment

0

Use Player.UserId since you never identified “player”

1 answer

✓ Accepted answer

Instead of

local playerUserId = "player_"..player.UserId

do

local playerUserId = "player_"..Player.UserId

This discussion is preserved as it was. New answers, comments, and votes are closed.