How do i get body velocity consistent on all clients

I have a skill that pushes the user forward using body velocity. i have a loop that detects when the user is close to someone. to do the attack. once they detect someone they do the effect and damage. everything but the damage is done on client.

The issue
The person who is getting hit on their screen. the attacker isnt even near them. so the effect doesnt happen. but on the attackers screen they’ve hit them and the effect has gone through. this is very jarring. how do i sync them up?

I’ve tried doing it all on the server. and changing the network owner of the rootpart to the server. but that didnt work well at all. and also the body veloctiy doesnt stop properly.

Person who is getting attack perspective
Image from Gyazo
Person who is attacking perspective
Image from Gyazo

1 Like

You could do a remote event for onattack and have a script in serverscriptservice handle the bodyvelocity

The onattack would be triggered when the player pressed the attack button/key, and the script in serverscriptservice would determine whether or not the attack hit anything and would then apply bodyvelocity to whatever the player hit.

2 Likes