[Solved] Save Slider value in blocks

hello i’m working on a project and i’m kind of new to thunkable, so maybe i’m just not understanding if i’m doing something wrong.
in one of my screens i put some sliders, and since i want the value i set them to to be remembered when i come back to the screen after closing the app, i used these blocks (image 1) to store it.


yesterday, when i made it, everything was working just fine. today coming back to it, when i try to change the value it displays this error message (image 2).

does anyone have an idea on how to fix it? am i just making a dumb error that i can’t see?
thank you guys, and sorry if anyone already posted something similar to this, im kind of in a rush and i don’t have the time to check every topic

Do you need to check that the value isn’t null before setting the slider to it?

What platform are you testing on? (Thunkable Live or installed? iOS/Android/Web app?)

One way I like to debug code that’s crashing like this is to start disconnecting blocks. If you unplug all the calls to local storage in the “when weather starts” blocks and the crash stops, you know the problem is there…

hi, im testing on thunkable live, web app i think?
i’ll try what you said and start working from there, thank you!

Were you testing the same way last time? Not on a phone?

oh no yeah i’m testing on android, sorry i misunerdstood (english isn’t my first language)
and yes i’ve always been testing on android

Got it. You can get that screen if you ask Thunkable to do something that’s not allowed and it crashes.

image

Where’s that green “newValue” block coming from? The slider on value change gives a “value” block to work with, but I don’t see where “newValue” comes from, and I wonder if you meant that to be the “value” block, and if that’s causing the crash.

1 Like

@catsarisky Good catch! Yep, those green blocks are special… they can only be used inside of the block they are attached to.

1 Like

THANK YOU!!! it’s probably because i copied the blocks from the ones i used for some switches
now they work perfectly <3

2 Likes