Discuss Scratch

MKRTG
Scratcher
9 posts

Cloud Variables not working correctly.

I am currently working at my new game, but my cloud highscore wont work, ive checked it 100times and i cant figure out the problem.
Its a simple highscore system, if currentscore > cloudScore then set cloudscore to currentscore
And if i play the game it works, i can restart the game and it saves, but as soon as i reload the page, the cloud variable returns to the normal value.
When the cloud variable is 3 and i save in the editor, then that normal value is 3.
here is the project: https://scratch.mit.edu/projects/887213493/
The cloudhistory changes btw
Link2358
Scratcher
100+ posts

Cloud Variables not working correctly.

This is happening because the world highscore variable is not a cloud variable. Putting a cloud emoji at the start of the variable name does not make it a cloud variable, scratch adds that emoji regardless.
To make a cloud variable, you need to check the Cloud variable box:
MKRTG
Scratcher
9 posts

Cloud Variables not working correctly.

I did not add a cloud emoji lol
I’m using scratch since 3. years and this never happened to me.
It in fact, is a cloud variable
AHypnoman
Scratcher
1000+ posts

Cloud Variables not working correctly.

MKRTG wrote:

It in fact, is a cloud variable
It's not. Delete the variable and create it again, but this time toggle the cloud variable button.

Did you at any point download the project and re-upload it to Scratch? That resets cloud vars into normal variables.
MKRTG
Scratcher
9 posts

Cloud Variables not working correctly.

Okay very weird thing rn, I deleted the cloud variable and tried to make it again but it said it has already been created, then I instead chose another name and it said this also has been created.
I once used this name for a cloud variable but its been long gone..
MKRTG
Scratcher
9 posts

Cloud Variables not working correctly.

Okay, I now created a new cloud variable with a new name and its the exact same issue.
You can even see it has been changed
But the game just doesnt show that
AHypnoman
Scratcher
1000+ posts

Cloud Variables not working correctly.

This sounds like a weird idea, but it might work:

Change this code in the backdrop:

whenclickedforeverifcurrentscore>CLOUDHighScorethenset☁ CLOUDHighScoretocurrentscore

To this code:

whenclickedforeverwait1secondsifcurrentscore>CLOUDHighScoreandnotisMenu=1thenset☁ CLOUDHighScoretocurrentscore

This is because Scratch limits how fast cloud vars can be changed (I think).

Another way to do it would be to have a separate cloud variable that is set to a random number by the user at the start of the project because I realised that the “handshake” between the cloud server and user never happens meaning that the user never gets told the value of the cloud variable. Try this before the other I think this is probably most likely.
MKRTG
Scratcher
9 posts

Cloud Variables not working correctly.

What do you mean, I do not understand that random number thing you told me
AHypnoman
Scratcher
1000+ posts

Cloud Variables not working correctly.

MKRTG wrote:

What do you mean, I do not understand that random number thing you told me
This code:

whenclickedset☁ helper variabletopickrandom1to100000

Sorry for the late reply.
MKRTG
Scratcher
9 posts

Cloud Variables not working correctly.

Okay, but how does this code help me ?
Like if I do this, how does it help me make my main variable work again ?
MKRTG
Scratcher
9 posts

Cloud Variables not working correctly.

After some time, I went back to this project and fixed it.
How ?
I put a forever loop that sets the cloud variable to itself, so cloud variable = cloud variable and this somehow made it work.
bruhhhimnoon
Scratcher
23 posts

Cloud Variables not working correctly.

MKRTG wrote:

After some time, I went back to this project and fixed it. How ? I put a forever loop that sets the cloud variable to itself, so cloud variable = cloud variable and this somehow made it work.
Please do not necropost, as necroposting may get your comment reported. A necropost is about at least 1 month old or the post is resolved. (date of post: 04-20-24, 0 years old) This post is not resolved. NOTE: Please don't say that I'm being rude. It's just that I'm trying to remind people that necroposting is only good when the post is mentioning something that hasn't been mentioned, and stays on topic. If you didn't already know, a necropost is generally referred to as a reply to an old, abandoned thread that has been considered “dead” for a while. This is basically saying that a necropost is a reply to a comment that was posted a long time ago, for example, someone makes a post, then 4 years later, someone replies to it. That's necroposting. Oh and also, thanks for reading my post.
This post is directed at MKRTG. Learn more about necroposting here.
This text was made by my necropost text gen.
Oh! I forgot to say, please try to avoid this in the future!

Powered by DjangoBB