Timer Error: \gamemode\sqlcar.lua:99: Tried to use a NULL entity!

Lua Error: Timer Error: \gamemode\sqlcar.lua:99: Tried to use a NULL entity!

The error above breaks my SQL script, what can I do against this? Line 99, is “SteamID = ply:SteamID()”



function PlayerInitialSpawn( ply )

	timer.Create("Steam_id_delay", 1, 1, function()
	SteamID = ply:SteamID()
	ply:SetNWString("SteamID", SteamID)
	timer.Create("SaveStat", 10, 0, function() saveStat( ply ) end)
	player_exists( ply )
	end)
end
hook.Add( "PlayerInitialSpawn", "PlayerInitialSpawn", PlayerInitialSpawn )


just use ID and not SteamID thats shut work better
or use

local SteamID = ply:SteamID()
that shut work the best i think

Just a little helpful hint. :slight_smile:

You don’t even need to use a NWVar for the SteamID it’s shared…

Don’t use a NWVar when you can just go (your player object):SteamID()

Forget all of what you just put.

Use this instead…