How to make a clip only able to play once

The question is quite vague so let me explain i to you:

Once the clip is clicked it plays it’s animation then stops, but if I click it again, it’ll play the animation again. I want once the clip has been clicked and played the animation, it won’t be “clickable again”.

Can anyone help me? For reference here is my code:

Default:

let a = 0;

Mousereleased

if (a === “0”)
{
this.play();
a += 1;
}

It seems that when clicking it, Mouseclick doesn’t work, rather it is Mouserelease (refer to my last post)

Hi,
I would put a into this; that way it will be saved.
I think, this way, it will be set every time “you get there”, so it would be - every time.
You could console.log this to verify.

regards,

Paul

a === “0” is checking if a is the character 0 not the number 0 (a === 0 )

Here’s an alternative to code-

  1. Select the clip
  2. On the “Inspection” tab there should be a lable called “Animation”
  3. Select it and change to play once

Here’s a pic:

(Apologies for the unfamiliar layout. I’m on mobile.)

good one - missed that :slight_smile: