How do I fix this script?

Screenshot 2023-12-16 10.04.19 AM
This is some code I made that’s supposed to count down every time it receives a pulse from a wire repeater clock.

The top “if get property ‘toggled?’ = 0” is a latch that will prevent it from resetting to 10 seconds each time it gets a pulse.

The “if ‘text’ ≠ 0” just makes sure the counter doesn’t go below zero.

The bottom Broadcast Message On Channel just sends a message to the repeater clock saying that everything’s working.

Timer is a property so it can be set to whatever I want in a later part of my game.

The only issue is it won’t actually count down. Either it will stop at 9 or it will head straight for the value I’m decreasing it by (for example, if I put “change ‘Text’ by -1”, then it will immediately set it to -1). If anyone knows how to fix this, please let me know.

You can’t have toggled be both true/false and number.

I changed the top query to “if ‘Toggled?’ = False”
It doesn’t change anything. It probably solved some other issues I would’ve ran into in the future, so thanks anyways.

1 Like

welcome to the forums @Hypercluk, but this is the only thing I am bad at, blocks, I can’t help ya :[

Variables don’t save in between block usage, so if you set the variable the first time the block runs, it won’t save until the next time.

also the -1 is not actually there I don’t think, it is just a preview
also Welcome To The Community Hypercluk!