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: Data Persistance; SaveNumber keeps erroring.

Previous Thread :: Next Thread 
LordVoldemort999 is not online. LordVoldemort999
Joined: 17 May 2009
Total Posts: 227
22 Aug 2012 12:30 PM
So here's the situation: I've got a basic leaderboard script, and I'm saving the KOs/Deaths, and the ouput I get is:

"Saving error: Unable to cast Instance to double"
"Saving error: Unable to cast Instance to double"

Here is the portion of the script pertaining to the saving/error:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
local KOsKey
local succ,ret = pcall(function() player:SaveNumber(KOsKey,player.leaderstats.KOs) end)
if succ then
print("Successfully saved")
else
print("Saving error:",ret)
end

local DeathsKey
local succ,ret = pcall(function() player:SaveNumber(DeathsKey,player.leaderstats.Deaths) end)
if succ then
print("Successfully saved")
else
print("Saving error:",ret)
end
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I've tried looking on the wiki/google search and nothing has come up.
If you actually understand what the error (Unable to cast to double) means, please post, I'd be grateful.

(Secret to getting errors for DP saving in Visit mode: instead of clicking the 'X in the far top right corner, click the smaller one for the place, not the entire window, it means the output window stays and you can read any error[s])

~~Modulante Vita~~
Report Abuse
su8qqingcuzbanned is not online. su8qqingcuzbanned
Joined: 28 Jul 2012
Total Posts: 164
22 Aug 2012 12:34 PM
player.leaderstats.KOs.Value*
Report Abuse
LordVoldemort999 is not online. LordVoldemort999
Joined: 17 May 2009
Total Posts: 227
22 Aug 2012 12:38 PM
I already tried that, but thanks all the same.

(By the way, the error for your idea is: "Saving Error: Argument1 missing or nil")

~~Modulante Vita~~
Report Abuse
su8qqingcuzbanned is not online. su8qqingcuzbanned
Joined: 28 Jul 2012
Total Posts: 164
22 Aug 2012 12:39 PM
yes because you didnt set KOsKey or WOsKey to anything
Report Abuse
LordVoldemort999 is not online. LordVoldemort999
Joined: 17 May 2009
Total Posts: 227
22 Aug 2012 12:47 PM
Tried it; same error as before: "Saving Error: Unable to cast to double"

Updated script is as follows:


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

local KOsKey = player.leaderstats.KOs.Value
local succ,ret = pcall(function() player:SaveNumber(KOsKey,player.leaderstats.KOs) end)
if succ then
print("Successfully saved")
else
print("Saving error:",ret)
end

local DeathsKey = player.leaderstats.Deaths.Value
local succ,ret = pcall(function() player:SaveNumber(DeathsKey,player.leaderstats.Deaths) end)
if succ then
print("Successfully saved")
else
print("Saving error:",ret)
end

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

That update didnt really do much.

~~Modulante Vita~~
Report Abuse
su8qqingcuzbanned is not online. su8qqingcuzbanned
Joined: 28 Jul 2012
Total Posts: 164
22 Aug 2012 12:48 PM
do you know what the key even does?

it's like a variable, an identifier.

set it to something like

"KOS"
and
"WOS"

and use that freaking .Value already
Report Abuse
LordVoldemort999 is not online. LordVoldemort999
Joined: 17 May 2009
Total Posts: 227
22 Aug 2012 01:05 PM
If the key is an identifer, they name should not make any difference, so long as the name remains constant. I added the .Value as well, and my problem now is that it's waiting for DataReady. So then I tried it in server and..... nothing happened.

Trying to debug another way now.

._.


~~Modulante Vita~~
Report Abuse
su8qqingcuzbanned is not online. su8qqingcuzbanned
Joined: 28 Jul 2012
Total Posts: 164
22 Aug 2012 01:07 PM
you dont know how the key works

let me fix it for you

local KOsKey = "KOs"
local succ,ret = pcall(function() player:SaveNumber(KOsKey,player.leaderstats.KOs.Value) end)
if succ then
print("Successfully saved")
else
print("Saving error:",ret)
end

local DeathsKey = "WOs"
local succ,ret = pcall(function() player:SaveNumber(DeathsKey,player.leaderstats.Deaths.Value) end)
if succ then
print("Successfully saved")
else
print("Saving error:",ret)
end
Report Abuse
LordVoldemort999 is not online. LordVoldemort999
Joined: 17 May 2009
Total Posts: 227
22 Aug 2012 01:36 PM
I've tried every variation I can think of, including yours, and when I test it, it says "Saving Error: waiting for DataReady()"
Report Abuse
su8qqingcuzbanned is not online. su8qqingcuzbanned
Joined: 28 Jul 2012
Total Posts: 164
22 Aug 2012 01:39 PM
well then add it
Report Abuse
LordVoldemort999 is not online. LordVoldemort999
Joined: 17 May 2009
Total Posts: 227
23 Aug 2012 11:08 AM
Done that, but you can't debug it if you add it, so I just tested it in Multiplayer and.... nothing happens.

._.


~~Modulante Vita~~
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