How do i change animation speed with a key press?

Please help me…… I’m really trying everything

Hi @Gavin_Durbin!

What have you already tried?

Do you use the animation component or the anim component and is this component on the entity with the script?

I used a chat that was discussed earlier on the forums, and i also tried to use my own attributes or variables and such

Can you also answer this please? Otherwise it is difficult to suggest the correct code.

I tried but nothing happens, i just can’t seem to get any way to change it

I’m asking for information that I need to help you. If you are unable to provide that information then I am unable to help you with this.

Yes, i used animation. Component AND anim component, but i can’t get to scale it.

It sounds illogical to use both components together.

If you use the animation component you can use this example:

if ( {
    this.entity.animation.speed = 2;
else {
    this.entity.animation.speed = 1;

If you use the anim component you can use this example:

if ( {
    this.entity.anim.speed = 2;
else {
    this.entity.anim.speed = 1;

This code has to be in the update function of the script that’s on the entity with the component. This code only change the animation speed and not the speed of the movement.