Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Cloud Data not Saving Correctly
- GoldenMiru
-
26 posts
Cloud Data not Saving Correctly
I recently finished a game that has a “highscore list” using cloud data that stores the top 5 highest scores.. except it isn't working.
Sometimes the scores save correctly, yet sometimes the scores reset to the original scores when I shared the project, wiping all the previous scores.
What doesn't make sense is the only variable that ever stored those original scores was the cloud variable itself, and after it has been modified that data should be gone, but it keeps coming back. I have scrutinized my code but have no idea what could be causing this.
I have deleted and remade the cloud variable to see if that fixes the issue but sadly doesn't.
Has anyone been experiencing similar cloud data issues or know what I could be doing wrong?
Here is the project, the cloud data code is stored in the sprite named “Top5”:
https://scratch.mit.edu/projects/731086158
Thanks for your help in advance, Scratch Forum!
Sometimes the scores save correctly, yet sometimes the scores reset to the original scores when I shared the project, wiping all the previous scores.
What doesn't make sense is the only variable that ever stored those original scores was the cloud variable itself, and after it has been modified that data should be gone, but it keeps coming back. I have scrutinized my code but have no idea what could be causing this.
I have deleted and remade the cloud variable to see if that fixes the issue but sadly doesn't.
Has anyone been experiencing similar cloud data issues or know what I could be doing wrong?
Here is the project, the cloud data code is stored in the sprite named “Top5”:
https://scratch.mit.edu/projects/731086158
Thanks for your help in advance, Scratch Forum!
- GUYWHOLOVESCODE
-
500+ posts
Cloud Data not Saving Correctly
This may be better in either HwS or the Report Cloud Data Glitches Here topic. I'm reporting it to be moved.
Anyways, I would suggest that you look for instances of the variable in your code to make sure it's not automatically set by a forgotten set of code used to test it.
Anyways, I would suggest that you look for instances of the variable in your code to make sure it's not automatically set by a forgotten set of code used to test it.
- MasterofTheBrick
-
1000+ posts
Cloud Data not Saving Correctly
Unable to replicate the issue. Are you able to attach the recurring leaderboard data in your next post?
- GoldenMiru
-
26 posts
Cloud Data not Saving Correctly
When you load the project (or refresh the page) there is a 50/50 chance the cloud data variable will correctly give the current value or incorrectly load the old value (the value the highscore variable was when I last saved the project). That value is not saved anywhere and if you look in the cloud monitor page the cloud variable no longer holds that value.
(The old value holds 5 dummy usernames all with highscore of 1, the correct value (at present) is my user with a score of 8 in 1st place with 4 placeholder scores of 1)
I've found the problem is reading the cloud data variable, saving the variable works just fine.
The problem is when someone plays with the old highscores it will overwrite the correct highscores with the old ones, meaning there is 50% chance when anyone plays that the highscores will be reset.
I am having this exact problem on another project where it is much easier to see what is going on:
https://scratch.mit.edu/projects/172083743/
if you press “look inside” and see the “Highscore” variable it has the value 262 (the old highscore)
if you look in the project's cloud monitor page: https://scratch.mit.edu/cloudmonitor/172083743/
the cloud variable declares it has the value “314” (what the new highscore is)
To me this means it must be a glitch with Cloud Data itself but I seem to be the only one having this issue?
(The old value holds 5 dummy usernames all with highscore of 1, the correct value (at present) is my user with a score of 8 in 1st place with 4 placeholder scores of 1)
I've found the problem is reading the cloud data variable, saving the variable works just fine.
The problem is when someone plays with the old highscores it will overwrite the correct highscores with the old ones, meaning there is 50% chance when anyone plays that the highscores will be reset.
I am having this exact problem on another project where it is much easier to see what is going on:
https://scratch.mit.edu/projects/172083743/
if you press “look inside” and see the “Highscore” variable it has the value 262 (the old highscore)
if you look in the project's cloud monitor page: https://scratch.mit.edu/cloudmonitor/172083743/
the cloud variable declares it has the value “314” (what the new highscore is)
To me this means it must be a glitch with Cloud Data itself but I seem to be the only one having this issue?
Last edited by GoldenMiru (July 26, 2023 22:34:20)
- deck26
-
1000+ posts
Cloud Data not Saving Correctly
I'd advise against assuming the connection to the cloud variables is immediate - you call the block to read the high scores from a green flag script. Give the project a couple of seconds to establish the connection before you do anything at all with cloud variables including checking the current score against a cloud variable.
If the link hasn't been established the saved version of the variable within the project will be accessed instead. That version is there so non Scratchers can still run the project without needing the cloud.
If the link hasn't been established the saved version of the variable within the project will be accessed instead. That version is there so non Scratchers can still run the project without needing the cloud.
- MasterofTheBrick
-
1000+ posts
Cloud Data not Saving Correctly
Was intending to bring this up as well, but I’m not sure if it’s the case for the second project the OP has provided. In theory with reference to the above concept, the updated cloud score should have been displayed after running the game once (and returning to the main menu), even if the text engine had initially loaded the last locally saved version of the cloud variable. Give the project a couple of seconds to establish the connection before you do anything at all with cloud variables including checking the current score against a cloud variable.
- GoldenMiru
-
26 posts
Cloud Data not Saving Correctly
I'd advise against assuming the connection to the cloud variables is immediate - you call the block to read the high scores from a green flag script. Give the project a couple of seconds to establish the connection.
I had thought this could be an issue, and I had modified it to only read the variable once you've played the game and returned to the menu, but it didn't fix the issue so I changed it back.
It does not ever set the variable to anything until you play the game and get a highscore, which does take a few seconds.
When it changes the variable it also re-reads it just before to make sure it is up to date.
Last edited by GoldenMiru (July 27, 2023 14:41:01)
- MasterofTheBrick
-
1000+ posts
Cloud Data not Saving Correctly
Update - doubting if it’s a script issue at this point in time. Established 3 observations after reloading and running the project 7 consecutive times (cache cleared), with each bullet representing a separate reload:
- First startup, list displays @GoldenMiru‘s score of 11.
- Obtained a score of 10, list displays GoldenMiru’s and personal username with their respective scores.
- Third time accessing the project, no data displayed whatsoever. Data log clearly indicates saving the previous (second highest) score of 10, however cloud variable reports an empty output when accessing it via the editor.
- Subsequent 4 reloads fluctuate between screening the updated leaderboards (Miro 11, personal score of 10), or remaining blank for the duration of the project.
- GoldenMiru
-
26 posts
Cloud Data not Saving Correctly
Thanks for doing this testing. I have come to the same conclusion.
Last night I made the cloud data variable show in the project to eliminate anything to do with the text engine.
Sometimes it would show the old value and remain like that
Sometimes it would show the old value but correct itself after 10-60seconds (quite slow)
Other times it would load correctly
I added a patch where it won't update the cloud variable if it has the old value, so scores won't be overwritten now, but that hasn't fixed the bug that it won't load the variable correctly because that seems outside of my control.
Can someone move this to BaG? (I don't know how)
Last night I made the cloud data variable show in the project to eliminate anything to do with the text engine.
Sometimes it would show the old value and remain like that
Sometimes it would show the old value but correct itself after 10-60seconds (quite slow)
Other times it would load correctly
I added a patch where it won't update the cloud variable if it has the old value, so scores won't be overwritten now, but that hasn't fixed the bug that it won't load the variable correctly because that seems outside of my control.
Can someone move this to BaG? (I don't know how)
Last edited by GoldenMiru (July 28, 2023 13:18:52)
- -MythGaming-
-
100+ posts
Cloud Data not Saving Correctly
I recently finished a game that has a “highscore list” using cloud data that stores the top 5 highest scores.. except it isn't working.
Sometimes the scores save correctly, yet sometimes the scores reset to the original scores when I shared the project, wiping all the previous scores.
What doesn't make sense is the only variable that ever stored those original scores was the cloud variable itself, and after it has been modified that data should be gone, but it keeps coming back. I have scrutinized my code but have no idea what could be causing this.
I have deleted and remade the cloud variable to see if that fixes the issue but sadly doesn't.
Has anyone been experiencing similar cloud data issues or know what I could be doing wrong?
Here is the project, the cloud data code is stored in the sprite named “Top5”:
https://scratch.mit.edu/projects/731086158
Thanks for your help in advance, Scratch Forum!
I'm experiencing glitches with the cloud variables as well
- parkmasterpro
-
42 posts
Cloud Data not Saving Correctly
im having this problem and i added a connected cloud var that is set to 1 but saved as 0 and when its equal to zero it won't let you in, but it never equals one even tho the log says its equal to 1.
- petstra
-
100+ posts
Cloud Data not Saving Correctly
im having this problem and i added a connected cloud var that is set to 1 but saved as 0 and when its equal to zero it won't let you in, but it never equals one even tho the log says its equal to 1.
Please create a new topic for your problem instead of necroposting.
- parkmasterpro
-
42 posts
Cloud Data not Saving Correctly
i did acually
i did acualy. im just looking for places where i can get info that already exists.
heres the post: https://scratch.mit.edu/discuss/topic/759499/?page=1#post-7961629
im having this problem and i added a connected cloud var that is set to 1 but saved as 0 and when its equal to zero it won't let you in, but it never equals one even tho the log says its equal to 1.
Please create a new topic for your problem instead of necroposting.
i did acualy. im just looking for places where i can get info that already exists.
heres the post: https://scratch.mit.edu/discuss/topic/759499/?page=1#post-7961629
Last edited by parkmasterpro (May 8, 2024 16:23:16)
- GoldenMiru
-
26 posts
Cloud Data not Saving Correctly
I have found that renaming a cloud data varaible can get it working again if it isn't behaving as it should
- GoldenMiru
-
26 posts
Cloud Data not Saving Correctly
I have found that renaming a cloud data varaible can get it working again if it isn't behaving as it should
- MudkipKappa
-
500+ posts
Cloud Data not Saving Correctly
Please don't post on old, irrelevant topics. This is a different issue than the one happening now.
- Stuff_Happens_123
-
4 posts
Cloud Data not Saving Correctly
My browser / operating system: ChromeOS 14541.0.0, Chrome 129.0.
Sorry testing scratchblocks. I have found that adding a constantly updating cloud variable helps tho.
Sorry testing scratchblocks. I have found that adding a constantly updating cloud variable helps tho.
- Discussion Forums
- » Bugs and Glitches
-
» Cloud Data not Saving Correctly