Hello everyone. I want to know how to make a knockback without delay.
Often times when I use BodyVelocity or LinearVelocity to create a knockback within the enemy’s HumanoidRootPart, there is always a very noticeable delay before the knockback actually takes effect. I am assuming this is because the velocity constraints take time to build up force and eventually kick in.
I was thinking of using TweenService on the HumanoidRootPart as a method for knockback. However that wouldn’t be efficient as that would take away the enemy’s any chance of moving during the knockback tween. TweenService also ignores the CanCollide property and is determined to take the tweening part to its goal destination by phasing through walls, objects, etc.
I have seen some games achieve this kind of “instant knockback” effect. But I am not sure how they do it… If anyone knows, Please share your knowledge with me!
This is because of client-server lag.
I’m assuming you’re sending a message from the client to the server to add a bodyVelocity to the enemy. However, in the time it takes to send that message to the server and then back to the client, a bit of lag time is created.
The only way I can imagine doing this would be to handle everything on the client, then replicate it to the server.
Although I personally don’t have much experience with this, I would recommend looking into VectorForce and ApplyImpulse.
You can also try directly setting the AssemblyLinearVelocity of the characters you’re trying to knock back, but I would imagine that would have some undesirable results.