|
| 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 |
|
|
|
| 22 Aug 2012 12:34 PM |
| player.leaderstats.KOs.Value* |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 22 Aug 2012 12:39 PM |
| yes because you didnt set KOsKey or WOsKey to anything |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|