How to make clones do something? SOLVED


(Sorry for making this, idk much about clones though)

So I’m making this project, and I’m trying to make the editor super compact, so I want to use clones for this.
But some clones will have to do stuff, so how do I make a clone do something like set a value to __, when, say, it’s tapped or something like that?

@ codehelp

How do you make an animated pixel art/moving trail art

I know a lot about clones, so just give me a problem you need to solve and I could help.


Ok thanks so much!!


Could you be more specific?
gtg see you tomorrow


Ok bye.

Anyways I need to make a clone set a value to 4, when the clone is tapped.


I think someone could help you with that while I’m gone. Bye!


Hi @tankt2016 I can help u

1 Like

There is a Hopscotch Academy lesson on Clone ID I made, I will quickly get the link

1 Like

Here is the link:

1 Like

Clone Index allows you to control a clone individually. To use it just use
(Check once if (Clone Index) = (2 (for example)))
Whatever you want the clone to do.

1 Like

BTW the original object is clone #1, the first clone is clone Index #2


Thanks so much @TheDeliciousOrange, @HopscotchRemixer! Although how would I have the clone know when it’s been tapped, and do something?

1 Like

(When (Self) (Is tapped)
(Check once if ((self) Clone Index = 2) (or whatever)
Insert Code here

1 Like

Thanks so much! (You’re getting credit btw)

1 Like

Oh thanks Tankt.

1 Like

Why isn’t this working?
I know I did something wrong somewhere.
(The clones are supposed to be the options for the text colors, in the settings app. The original one is light gray.)


You tried to use a created variable for clone index. While this is an option, the way you tried to use it does not work.
When clones were first added, it would result in the original object ID being 3, and all the clones being 1. Now, it results in the original object being 3, and the clones being 0.
This is because the clones no longer do the code after the block which creates them in the rule which creates them. So even if you correctly set up the ID in that way, it would no longer work.

Do you see why it wouldn’t have worked even if the clones were doing the set variable blocks?

While you could leave this rule as it is, and simply have the clones set their own value based off of the original object’s, that would not be the best way and would make bugs easier to create.
Hopscotch automatically counts the clones, in the clone index property. I’d recommend using that. So the new code would be three create a clone blocks, and replace all clone ID variables with clone index.

An important thing to remember is that clone ID starts at 1, so the original object has a clone ID of 1.

Another good use of clone ID would allow you to have only one set position block in the when object is cloned rule, outside of the check once ifs. Can you see what it is?


Just do ‘When (Self) is tapped’ set (Value) to (4). Or, you can use clone index if that isn’t what you meant. Feel free to tag me anytime!


I´m pretty sure that your first solution solves what @tankt2016 was looking for. I´m also here to help, so if anything else is needed, just tag me! :slight_smile:


Use the clone index variable! You can search it on the forum for help with it.

1 Like