Discuss Scratch

quick-key
Scratcher
23 posts

Changing score so weird

My browser / operating system: ChromeOS 14816.131.0, Chrome 103.0.0.0, No Flash version detected

The coins should increase by 1 if coins per click is 1. But it's changing by like tens/hundereds.

Can somebody tell me why is it doing this(open link):
https://files.catbox.moe/ha1gt6.webm

You can find the code right here:
https://scratch.mit.edu/projects/1314487855/editor

if <answered?> then
Thank you!
end
LittleGreyCells
Scratch Team
1000+ posts

Changing score so weird

Moved to Help With Scripts
10goto10
Scratcher
1000+ posts

Changing score so weird

The problem is that the clones of your coin sprite are also receiving the broadcast.

I made a remix that uses a ‘for this sprite only’ variable to make sure that only the coin sprite makes a clone, https://scratch.mit.edu/projects/1374579090/
quick-key
Scratcher
23 posts

Changing score so weird

10goto10 wrote:

The problem is that the clones of your coin sprite are also receiving the broadcast.

I made a remix that uses a ‘for this sprite only’ variable to make sure that only the coin sprite makes a clone, https://scratch.mit.edu/projects/1374579090/

Only the coin sprite makes a clone? That looks like it is. I only understand about:
Global variables - for all sprites, including clones.
Private variables - for one sprite, only its clones.

Last edited by quick-key (Aug. 23, 2026 20:06:26)

10goto10
Scratcher
1000+ posts

Changing score so weird

quick-key wrote:

Only the coin sprite makes a clone?
That’s right.

quick-key wrote:

That looks like it is. I only understand about:
Global variables - for all sprites, including clones.
Private variables - for one sprite, only its clones.
I think you’ve got the right idea. A variable created ‘for this sprite only’ is a private variable for that sprite and any clone that is created gets its own private variable.
quick-key
Scratcher
23 posts

Changing score so weird

10goto10 wrote:

quick-key wrote:

Only the coin sprite makes a clone?
That’s right.

quick-key wrote:

That looks like it is. I only understand about:
Global variables - for all sprites, including clones.
Private variables - for one sprite, only its clones.
I think you’ve got the right idea. A variable created ‘for this sprite only’ is a private variable for that sprite and any clone that is created gets its own private variable.

Got it.
quick-key
Scratcher
23 posts

Changing score so weird

10goto10 wrote:

quick-key wrote:

Only the coin sprite makes a clone?
That’s right.

quick-key wrote:

That looks like it is. I only understand about:
Global variables - for all sprites, including clones.
Private variables - for one sprite, only its clones.
I think you’ve got the right idea. A variable created ‘for this sprite only’ is a private variable for that sprite and any clone that is created gets its own private variable.

But why is the clones of coin sprite are also receiving the broadcast? I didn't put the broadcast in when I start as a clone event.
10goto10
Scratcher
1000+ posts

Changing score so weird

The way it was working, if there was a clone on the screen then it would have received the broadcast made by clicking on the stage.

If a player had clicked slowly enough and only had done a click when there were no coins on the screen then the counter would have only increased just one time per click. But if there were a lot of coins of the screen then each coin would have increased the counter by one.


Or are you asking a design question? "Why do clones start with event hats activated if they are started with all scripts stopped? If this is your question then I don't know. It's not actually consistent. To be consistent Clones should be created with all of the running scripts still running and all of the event hats active or else started with both disabled. But that's not how the Scratch Team wanted their software to work and it has endlessly caused confusion for people.

Powered by DjangoBB