|
| 15 Dec 2011 09:42 PM |
game.Players.PlayerAdded:connect(function(player) player:WaitForDataReady() a = pcall(player:LoadNumber("KOs")) player.leaderstats.KOs.Value = a end)
game.Players.PlayerRemoving:connect(function(player) if player.leaderstats ~= nil then b = player:SaveNumber("KOs") b = player.leaderstats.KOs.Value end end)
Leaderboard being used: LinkedLeaderBoard Leaderboard Script Position: Workspace This scripts Position: Workspace What I want: What I need to fix and how or a correct basic leaderboard save/load script. |
|
|
| Report Abuse |
|
|
|
| 15 Dec 2011 09:44 PM |
Tell me what pcall() is,
I want a detailed explanation. |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 15 Dec 2011 09:52 PM |
It runs a function (I think it's a function) in a protected mode, so if it errors, the script continues to run. It returns if it worked or not, and the error if applicable.
It's a love-hate relationship.... |
|
|
| Report Abuse |
|
|
|
| 15 Dec 2011 09:58 PM |
http://wiki.roblox.com/index.php/Pcall#pcall_.28f.2C_arg1.2C_.C2.B7.C2.B7.C2.B7.29
pcall, a.k.a protected call, runs a function regardless of its errors. The advantages of this function is, IF the function DOES have any errors, it will return them.
i.e.
local boolean, output = pcall(function() Players:NullMethod() end) if boolean == false then print(output) end |
|
|
| Report Abuse |
|
|
|
| 15 Dec 2011 10:01 PM |
I know what pcall is :P, I wanted to see if HE knew....
But your hearts are in the right place :3 |
|
|
| Report Abuse |
|
|
|
| 16 Dec 2011 06:32 PM |
| Yes I know what pcall is.(I want to learn to script so I do my research). But it doesn't really seem to have any errors. |
|
|
| Report Abuse |
|
|