How to change another objects frame when hovering onto another?

Hi! I’m trying to figure out how to make another object change frames when hovering onto another object. Like, for example of what I’m attempting to do: when you hover over a button, the guy in the room will look over at the button.

I’m not sure how to go about doing it.

You can do this by writing something like the following in the button’s mousehover script:

player.gotoAndStop(2);

Replace “player” with the name of the other clip and “2” with the number of the frame you want it to go to.

Let me know if it works

It doesn’t work :-( I added it in the right place yet the other clip does nothing

How about you show us the file you’re working on? Is there also anything else that you have already tried, other than Hamzah’s solution?

1 Like

Alright, here. I tried using variables based on other things I’ve read here but it didn’t work

button.wick

Your code was correct, I think I found the issue.
You had the person’s animation set to “single frame”
You can fix this by setting the person’s animation to “loop” and adding this code inside of it’s default script:

this.stop();

While keeping the button’s code the way it is now.

Here’s a working version of your file (file was too big to upload here so I used google drive)

1 Like

OH I see!! That makes sense then oops. Thank you!

1 Like