Best way to force movement during an animation

Hey, trying to make tool that when you attack it locks your direction and dictates your movement during the animation.

So far I have the direction locking aspect completed, however I’ve hit a wall dictating player movement. So far I’ve set WalkSpeed to 0 for the parts of the animation that when it’s supposed to move you, however I’ve become stuck at the part where you force the player to move.

I cannot find a viable method of dictating player movement in a logical sense; walktopoint can be interrupted with input, bodyforce has been frusterating and inconsistant, and tweening involves a large amount of code for what should be a simple operation.

Is there any simple way to accurately and reliably do this?

I’ve been all over the devhub/devforum and scriptinghelpers, however I haven’t found any solutions that are reliable.

For reiteration’s sake, an example of what I want: An imput causes the character to step backwards relative to where they’re facing, however during the animation of the backstep the character has no control so that they cannot change the direction of thier step until the animation has been completed

Thanks in advance for any advice, if tweening is the only answer I guess I’m going to have to get better at modulescripts and make a catch all function.

3 Likes

this may help you with your question VectorForce | Roblox Creator Documentation

2 Likes

Thanks for the help, but vectorforce is expirencing the same difficulties as bodyforce i.e, the ground has a lot of traction and the air does not, such that the force required to move one on the ground is leagues greater than the force required to move in the air.

tl;dr: if preformed in the air it launches the character when using VectorForce due to friction

2 Likes

I’ve actually encountered this same issue here in a passion project I’m working on, to combat this issue of friction differences I’ve used BodyPosition instead. Hope this helped!

4 Likes

Thanks! Working on it now, never used bodyposition before. It’s a little weird but is seemingly more consistant between grounded and not states. I’ll mark as solved as soon as I find it viable, though my skimming through your showcase of it in effect I’ve no doubt it’s the path to take.

Would you use CFrames to find where HumanoidRootPart is looking and run a formula to find what you’d need to add to the vector3.new or am I going about it backwards?

Yes, I used a lookVector to find my HRP and then defined a distance forward, I took that position to put in, the speed and strength is all up to how you set up your bodymover.

1 Like

Awesome, that’s what I ended up doing with it as well, except using CFrames and Tweening until I understand BodyPosition better. Another issue I’ve got is that there’s a delay in where I’m facing and where I’m going between the client and the server, in a localscript the script is entirely accurate however in a normal script it lags behind. If I’d like to make it without the lag, and without local, is there any other methods? or just send a signal between the local and main scripts and have the main scripts be in charge of the data exploiters want i.e iFrames

EDIT: I figured it out, duplicated the whole script to a localscript and stripped out everything except for the CFrame TweenService and simply left that out of the serverside script. Now the player goes where they’re pointing and the game is a little harder to exploit. Granted, I’m now running two scripts for the same function rather than one but it works well.

1 Like