I’ve made a dodging system in my game using LinearVelocity using the Line mode, and it looks normal to the player, but to other players and the server I just seem to phase from 1 place to another.
Code I’m using (although I don’t think the problem comes from the code):
Not sure, but maybe its not replicated? Meaning the physics of the linear velocity only happen on the client but aren’t replicated to the server, therefore only the position the player ends up in is replicated.
Are you running the provided code on a local script or server script?
Maybe try using another method? ApplyImpulse might work? I think I made something similar to a dash in the past, might be able to dig through my stuff and find it, but I can’t think of much off the top of my head right now.
EDIT: Found another post, solution here was to run the linearVelocity on the client… not sure why its like that, but it might work.
It works now, but how would I remove the force if it’s on the client if handling the roll system is on the server? Since I want the roll’s force to be removed if you dodge an attack with perfect timing.
You could fire an event back to the client to signal them to remove the linear velocity or you could check for the dodge on both the client and server at the same time, on the client you would then handle the damaging depending on dodging, the client would only check if they dodged to remove the linear velocity again, not to detect any damage or anything.
The latter is probably a bit tedious and I’m sure there is a better way, but using a remote event to send the signal back to the client might cause a delay and lag would certainly affect the system in that case.
I would probably make a shared module script in replicated storage that has a function or something to handle the dodge check, then run it on client and server at the same time, that way you don’t don’t have to write the code for checking twice.