This happens because you are probably (can’t tell) running this without a hook try it in initalize or run a think hook until the LocalPlayer has been created and do your initial spawn stuff there, then kill the think hook.
What I mean by the think hook:
[lua]
function ready()
if ValidEntity(LocalPlayer()) && LocalPlayer():Alive() then
RunConsoleCommand(“ready”)
ready_removed = true
//DO INIT SPAWN STUFF HERE
hook.Remove( "Think", "READY" )
end
end
hook.Add(“Think”, “READY”, ready)
[/lua]
The concommand is optional but a good way to tell the server the client is ready to be sent stuff etc.
I am calling it on the client, the text is yellow.
It doesn’t run the 1st time, but when I reload the gamemode, it works. However in the other location I’m using i, which is HUDPaint; it works the 1st time somewhat by saying that ClassData is nil, then it sais that field “?” is nil…so…
I have no clue why this isn’t working. I may end up changing how I build the table. I may do one big global table with all the player’s steam ID’s in it and have it like that and simply create a player’s portion of it when they spawn the first time.
That’s because when you run your code the first time there is no LocalPlayer yet. It’s like conman420 said but you should be using **[Gamemode.InitPostEntity