# Help with "on created" block

**URL:** <https://forum.makecode.com/t/help-with-on-created-block/30007>\
**Category:** Arcade\
**Created:** [August 7, 2024, 5:33pm UTC](https://forum.makecode.com/t/help-with-on-created-block/30007 "2024-08-07T17:33:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![insaniac](https://avatars.discourse-cdn.com/v4/letter/i/3be4f8/32.png) [@insaniac](https://forum.makecode.com/u/insaniac)\
**Post date:** [August 7, 2024, 5:33pm UTC](https://forum.makecode.com/t/help-with-on-created-block/30007/1 "2024-08-07T17:33:07Z")

</div>

Hi There  
I am struggling to use the “On Create” function correctly. I am hoping someone could please explain how I can use the “On Create” function to run every time I create a sprite of a certain kind (in this case a new type called “Trampoline”).

My son is following a tutorial whereby he is creating three trampolines that bounce back and forth. The idea is to create a “On Created” function every time a trampoline is made.

Here is the tutorial code:

> **[Trampoline v3](https://arcade.makecode.com/S66010-73676-09793-15633)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I would expect that we would use the “On Create sprite of kind Trampoline” - however in the tutorial they have managed to use a “On create trampoline of kind Trampoline”?? I can’t seem to create that block - nor did it make sense to me.

Here is my son’s code:

> **[Bouncing Man](https://arcade.makecode.com/S49129-61139-99324-96573)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Any help you can provide in explaining how to use the On Create block would be great. Thanks

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [August 8, 2024, 2:11am UTC](https://forum.makecode.com/t/help-with-on-created-block/30007/2 "2024-08-08T02:11:43Z")

</div>

Welcome, @insaniac !

They just changed the name of the variable. It doesn’t actually matter what the variable is called, whether `trampoline` or `sprite`, in the event handler. Just use the same name that appears in the function.

If you really want to change the name, then you should be able to do so. In a block within your function where you use `sprite`, use the dropdown and select **Rename variable…** to change the name from `sprite` to `trampoline`. Just be careful … it will change everywhere that name is used in your project.

---

<div class="post-metadata">

**Author:** ![abuislam](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@abuislam](https://forum.makecode.com/u/abuislam)\
**Post date:** [August 8, 2024, 5:05pm UTC](https://forum.makecode.com/t/help-with-on-created-block/30007/3 "2024-08-08T17:05:50Z")

</div>

Use the “On Created sprite of kind [Trampoline]” block to run code whenever a Trampoline sprite is created. The “On create trampoline of kind [Trampoline]” block might be incorrect. Check MakeCode Arcade docs for more details.
