Assigning points to a player

Hi there hopefully this is a fairly simple question, and I feel quite silly asking it. but is there an easy way to assign points to a player and store them? And of course allow them to be read by the scoreboard.

So far I have:

[lua]
function GM:PlayerInitialSpawn(pl)
pl:SetNWInt(“dead”, 0)
pl:SetTeam(TEAM_SPECTATOR)
pl:ConCommand(“gm_showteam”)
pl.switched_this_round = false

pl:SetPData("points", 0)

[/lua]

and to be read by the scoreboard I have…

[lua]function PANEL:UpdatePlayerRow(pl)
self.name_label:SetText(self.pl:Name())

if self.pl:GetNWInt("dead") == 1 then
	self.dead_label:SetText("Dead")
else
	self.dead_label:SetText("")
end

self.total_points_label:SetText(self.pl:GetPData("points"))

self.deaths_label:SetText(self.pl:Deaths())

self.ping_label:SetText(self.pl:Ping())

self:InvalidateLayout()

end
[/lua]

but every time I try to retrieve the score I get this error: includes/extensions/player.lua:147: attempt to call method ‘UniqueID’ (a nil value)

Also is there an easy way to save the player’s scores to a file so they can be read again if they reconnect etc?

Thanks in advance!

I save wins and losses and send them to the leaderboard but this requires multiple system for me. I have a table that gets information added to it when a player joins and if they leave it saves that info to a text document named by their steamid and loads it when they join. file.Write() and file.Read() (look those up on the wiki) now im also using a console command to tell the server to send that info to the player via user messages.
this is the server side function
[lua]function sendwinlosinfo(ply)
for k,v in pairs(player.GetAll()) do
umsg.Start(“points”,ply)
umsg.Entity(v)
umsg.Short(put_table_here_that_contains_players_points) – [[i have my table indexed by steam ids you could however index yours by entities as clients and servers can both read those where as the client cannot read steam ids.]]
umsg.End()
end
end
concommand.Add(“sendinfo”,sendwinlosinfo)[/lua]
and here is the client side
[lua]local pointstable={}
usermessage.Hook(“points”,function(UM)
local tabl={}
tabl[“ply”]=UM:ReadEntity()
tabl[“points”]=UM:ReadShort()
pointstable[tabl[“ply”]]={}
pointstable[tabl[“ply”]][“points”]=tabl[“points”]
end)
[/lua]