How To Move Character With Code?

Hey guys, Army here! :smiley:

So I’m setting up an animation, and pretty much, its like a blast movement. I’m making knockback though, but if the knockback is in the animation, my character isn’t considered changed position, so after the animation is done, my character zooms back into place, which is not what I wanted it to do.
Aaand we come to the reason why I put this in scripting support: I want to move the player with script. Not like they walk with the walk animation, but they move with the animation, so when the animation is done, they end up in the same position as the animation.


Any help is appreciated, and I will test any code tomorrow. :smiley:

1 Like

It would probably be better to not have the animation move the player and instead Tween the position of the characters’ root part.

This is a thread about tweening the character.


You should use a BodyMover and remove the knockback in the animation. Use KeyFrame events to add and remove the BodyMover

1 Like

just to clarify, he said he didn’t want to move the character in an animation.

1 Like

This method is probably better if you want it to be more dynamic and the one I mentioned would be better if you want it to be scripted.

1 Like

The character moves in the animation and he said the character teleporting back after the animation was the issue. So moving the character more permanently with Tweens would be better than doing it with the animation.


Either way its going to have to be scripted. Tweening isnt a bad idea but with BodyMovers you don’t have to worry about finding a goal position.

1 Like

i completely agree with you. i was just saying, he already stated that he didnt want to use an animator, and you thought he was. whatever doe

lets not argue.

Its 2 am why am I still awake

Well, tweening might actually be better, as I can just use += to set a position. Not to mention I can use a tweening style, which might give it a better style now.

I’ll answer back in 8-6 hours