The Ultimate Guide To Clones

About clones

clones are extremely helpful in keeping your code clean, along with they can do amazing things including

  • make an entire game in 1 object
  • generate smooth backgrounds easily and efficiently
  • make certain aspects of a game (a shape art, button, etc.)

so why aren’t they used a lot? they can be very confusing.

Cloning Methods

before figuring out clones, let’s look at methods of cloning.

Method 1: Normal Cloning

this is where you just put a repeat loop with create a clone inside:

Pros of Method 1:

  • easy

Cons of Method 1:

  • slow
  • only creates 1 clone at a time

Method 2: Total Cloning

basically in this method you have the clones create clones:

Method 2 explained

self(total clones) means the object’s total clones—which we want 50. every time a clone is made, that clone also makes a clone, and that happens until you get the desired amount of clones you want.

Pros of Method 2:

  • quicker

Cons of Method 2:

  • a little harder to understand
  • can lag up if used in mass amounts

Method 3: Secret Blocks

using JSON editing, we can implement a secret “create a clone times” block that instantaneously creates x amount of clones:

Pros of Method 3:

  • extremely quick
  • easy to read

Cons of Method 3:

  • can be hard to access the block

if you want to get the Create a Clones Times block, view this project by Awesome_E

Method 4:

Clone Index

What is it?

every time a clone is created, it gets an “index” or assigned a number. each clone of an object has a different index, the original object being 1, the first clone 2, second clone 3, etc.

notice that for each individual sprite the clone index starts at 1. this is VERY IMPORTANT.

Why is Clone Index important?

you can control many things with clone index—it’s very helpful. here’s an example:
you’re making a game with 1 object and want to set a variable (Play) to 1 when the button you made that says play is tapped.
Method 1
you could do this and set a boundary to make sure it was the play button that was tapped:

Method 2
or, with knowledge of clone index you could do this and check if the clone that was tapped has an assigned number of 5, 6, or 7:

  • method 1 is easier to understand
  • method 2 is easier to understand

0 voters

Making Clones Do Certain Things

this is pretty easy with a knowledge of clone index and doesn’t require an image or example. just do:

when object is cloned {
  check once if (clone index = 2) {
    set image(square)
} else check once if (clone index = 3) {
    set image(circle)

this means the clone with an index of 2 is a picture of a square, and the clone with an index of 3 is a picture of a circle.
pretty easy, right?

  • yes!
  • no, I’m confused (reply)

0 voters

  • I understand Clone Index better
  • I don’t understand Clone Index better
  • I knew clone index before reading but this is helpful
  • I knew clone index before reading and this isn’t helpful

0 voters

(Self) variables

so now that you know clone index, you can control self variables. basically, a self variable only assigns a value to a specific clone
for example:

this means that the clone that is assigned the index 2 has a personal variable called canBeInvisible set to 1. when canBeInvisible = 1 for any clone, that specific clone becomes invisible.

How to reduce lag with mass clones

easy; use the destroy block if the clone won’t be used again. do this by:

  when self(canBeDestroyed) = 1 {
    set self(canBeDestroyed) to 0 // optional and not necessary 

well, I think that covers it, hope this helped and please, let me know if you need help on something or have something to add:)

  • I understand clones better now!
  • I knew clones before, but this is helpful
  • I don’t understand clones better

0 voters

(omtl was tagged)


First post, very cool!

I’ll give some feedback after I read through it.


that got long lol, I didn’t think I wrote that much

ok, thanks for reading through all of that temmy


Ooh excellent



Hey no problem. Epic guide for people who don’t or want to know more about clones, good explanation on clone index too

No bad feedback, very good.


Great topic!

I understand clone index a lot better now


I already knew all this, but it will be extremely helpful for those who don’t understand clones!


Already knew all of this, but it’s gonna be super helpful to people that didn’t.
Nice job :))


I already knew clones bout I think this is a really helpful guide

lol you are a pro at making guides


This was a epic help :clap::clap:


Woah, this is really detailed and well-written! Amazing job!


Nice! I wish there was a guide like this when I was trying to learn clones. I bet it’ll be helpful to those who don’t know this stuff yet.


yeah I definitely need this incase of a project


Dude, this is epic! Super helpful tutorial!


@Awesomegirl25 This may help you.


I like it!

The first part is extremely similar to my clone tutorial. What are the chances :stuck_out_tongue:


Pretty cool!


oops lol I forgot you had one


Hi @Nobody

Here’s my favorite way to create clones. It wasn’t on your list.

I do this for several reasons.
• Efficiency. Doesn’t have an extra rule that the Player is continuously evaluating
• Timing. In advanced projects, sometimes you need the clones to start initializing at the same time as the Original Object
• Organization. Clean, well organized code helps prevent errors. (This is a theme of mine and is a key enabler to making more complex projects)

The custom rules keep things organized, but also make it easy to code both the original object and the clones (what is the original object other than just the 1st clone? I usually don’t need separate code just for the original object)

The Create Clones custom ability uses recursion (loops back to itself) like this until all the clones are created. And since both the original object and clones do this, the clones are created exponentially (really quickly).

Then after the Create Clones ability, I just use the second custom ability Initialize Object to put all the code that sets up the objects; color, position, passing data, etc


interesting, I’ve never seen this before

(@)leaders can one of you guys add this:

Method 4:

right under the sentence with the secret blocks link? thanks:)