BodyVelocity delays in my knockback script

I’m trying to create a knockback for my combat system. Basically, the 3rd hit knocks the enemy back…

The problem is, I use BodyVelocity to get that knockback effect but it appears delayed when I attack another player. Occasionally, the target doesn’t even get knocked back for some odd reason.
This can be seen here

I’ve done some research and found that the issue can be resolved by utilizing NetworkOwnership. I used the target’s HumanoidRootPart as the BasePart since it’s the parent of the BodyVelocity and I set the network owner to the player. This fixed the delay problem I had but it created another issue…

As you can see here, on the left side, there seems to be some sort of latency compared to the right side. The player that was knocked back (on the right) felt “laggy” as I was controlling it. It turns out that whenever a player was knocked back, their client would feel kinda laggy while walking, and it only happens when I changed the network owner.

The knockback part of the script was mostly done on the server, I tried to put it in a local script but the movement wouldn’t replicate to the server.

Thanks in advance!

Why? Why would you set the network ownership of one player to another player? Sure that fixes the issue but that might cause the other player to have some serious latency issues when they look from their perspective. Not to mention the security issues that could pose.

Latency is unavoidable between server and client, I would recommend applying the knockback effect as early as possible when confirming the hit. And if you really want to keep the network ownership assignment, please remember to set the network ownership of the player back to itself.

Though please, don’t actually set character network owners.


Extra Note:

Anything done on the client will not replicate towards the server, you have to use a remote event or remote function if you want to edit anything not related to UI by client action.

I saw similar posts relating to how network ownership affects body movers so I figured it could help address this issue, though I’m still fairly new to roblox physics so I’m not entirely sure, but thanks for the feedback.