Function and set animation of ( ) to (some action)

I wanted to make it so that the parameters can be put into the set animation of () to (play), but I can’t put the parameter inside the first brackets, what can I do?

Hi @TerribleAtCoding!

Unfortunately you can’t use variable for set animation of block.

If you want to implement something that complicated you may want to try the TypeScript out.

// Get item from the scene by ID. ID will be different for an item on you scene.
let item = Scene.getItem("YyTvUwCn") as AnimatedItem

// Declare variable with animation name
let animationName = "Agree"
// Set animation using variable
item.animation.play(animationName)
2 Likes

Uh I’m kind of new to javascript coding, why does this line not work?

Make sure that the item ID is correct

and that animation with specified name available

Also remix and take a look at sample space. Hope this helps :smiley:

Sorry, I indeed used the wrong method to set animation. A updated the example and sample space. Now it should work.