Discuss Scratch

TrueCodez
New Scratcher
4 posts

Background Switch not working

I’m using the backdrop-switching code with a variable to switch scenes, but it works fine for one button but not the other. I’ve tried all standard troubleshooting and nothing seems to work. I've been trying for 3 days and yet the problem still remains. Can someone please help me?
NMario84
Scratcher
1000+ posts

Background Switch not working

Maybe there is something in your script that is preventing the background change. Perhaps share your script so we can see where the issue is?

“It works fine for one button…..” - This makes it seem like you got it to work in one scenario. So it's something with whatever other script you are using that doesn't work.
tiaza
Scratcher
500+ posts

Background Switch not working

Hi, the Help with Scripts Forum would be a better place for your question.
About your question; There might be a Bug in your script which stops the Script from working.
You could also send a link to your project, you'd be helped more if we can look at the Script.
TrueCodez
New Scratcher
4 posts

Background Switch not working

Okay, I'll send the link, although I doubt there's anything wrong with the script, because the button that does work and the one that doesn't both have the exact same script
https://scratch.mit.edu/projects/1167483471
TrueCodez
New Scratcher
4 posts

Background Switch not working

The variables and all that work fine.. It's just that the background won't change
N8_D_GR8_1
Scratcher
500+ posts

Background Switch not working

TrueCodez wrote:

Okay, I'll send the link, although I doubt there's anything wrong with the script, because the button that does work and the one that doesn't both have the exact same script
https://scratch.mit.edu/projects/1167483471
I think what happened is that you have two messages with the same name in your program. They are both named “update scene”. In your left arrow sprite, delete this block:
broadcast [update scene v]
and replace it with a new one.
TrueCodez
New Scratcher
4 posts

Background Switch not working

I'll try that but since you can only pick one button there is only one broadcast happening at any given time; there are lots of things in my code that ma have overlapped but those are working just fine. Also, only the left button isn't working, when I press right it works just fine.
10goto10
Scratcher
500+ posts

Background Switch not working

It’s some kind of Scratch bug. I can’t reproduce the problem but it’s easy to fix.

Go to the “left” sprite and change

broadcast [ update scene v]

to

broadcast [ Intro v]

And then change it back to

broadcast [ update scene v]

That’s all I did to make it start working.

Maybe if someone looked at the JSON code they could figure out why.
N8_D_GR8_1
Scratcher
500+ posts

Background Switch not working

10goto10 wrote:

Maybe if someone looked at the JSON code they could figure out why.
I'm assuming each message has a name and an ID. Somehow, he was able to make two messages with different IDs, but the same name.

EDIT: I just checked the project.json. The broadcast ID of “update scene” in the “Left” sprite is “(Cz1{S4FDnZIpqF?lXhe” everywhere else, it is “KuwxQ/+/xJZN/MdX{oh`”

Last edited by N8_D_GR8_1 (April 30, 2025 22:14:14)

Powered by DjangoBB