generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Can someone tell me: What is wrong with this?

Previous Thread :: Next Thread 
onetimeaccount123 is not online. onetimeaccount123
Joined: 20 Oct 2011
Total Posts: 189
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
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
15 Dec 2011 09:44 PM
Tell me what pcall() is,

I want a detailed explanation.
Report Abuse
Quenty is not online. 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
TheNewScripter is not online. TheNewScripter
Joined: 02 Mar 2010
Total Posts: 2432
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
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
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
onetimeaccount123 is not online. onetimeaccount123
Joined: 20 Oct 2011
Total Posts: 189
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image