I’m using Body Velocity (I know it’s deprecated) because Linear Velocity is too buggy for my use case. However, I’m experiencing a delay when applying knockback with the last punch, as seen in the video. I’ve already set the network ownership to the server, but the knockback is still jagged and not smooth. I create the Body Velocity on the server.
if EnemyHumanoid then
EnemyHumanoid:TakeDamage(5)
EnemyHumanoidRootPart:SetNetworkOwner(nil)
local BodyVelocity = Instance.new("BodyVelocity", EnemyHumanoidRootPart)
BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BodyVelocity.Velocity = HumanoidRootPart.CFrame.LookVector * 100
Debris:AddItem(BodyVelocity, 0.1)
end
I have just tried it and it still have some noticeable delay. I also tried doing the knockback when the animation plays instead of if it reaches the event marker on the animation.
I would try and move to VectorForce, i used it for some combat and it worked pretty good no delays, when using a deprecated instance, things like this are not controllable. There could be other factors of a hidden wait time and such that is not seeable in the code you provided. But its better to go with new instances. I had to use a youtube tutorial to understand VectorForce so do not be afraid to look there as well
I just have now tried to add knockback on the client instead of the server, However, the knockback doesn’t work the enemy doesn’t get knocked backed. I added print statements and it goes through each line. It just doesn’t knockback the enemy.
he meant that when you apply forces (like using BodyVelocity , BodyForce , or VectorForce ) to a character on the client side, the forces will only work if the character is associated with a player. This is because the client needs to know which player the character belongs to in order to properly apply and replicate the forces.