This new code doesn't appear to reference your new_player function at any point.
I can see a few things else that want fixing, though.
Firstly when a player first spawns you create a ten-second infinitely looping timer to save his stats. But the name is always SaveStat, so when another player joins, it'll create the timer again and overwrite the old one. For the name you might want to do "SaveStat"..ply:SteamID() - so the timer is unique for each player.
On line 8 of your second code snippet you're creating a global SteamID - since you're presumably only using that in your timer function, make it local so it keeps the global table a bit cleaner. It also helps to local functions you're using as hooks - just put local before function and the functions won't needlessly go in the global table as well.
In your first snippet, query, result, result1 and result2 are only being used in that function, so make them local as well.
Sorry, you need to Log In to post a reply to this thread.