I’ve been working on a bumper cars game, but I’ve been having issues with input lag and can’t figure out how to fix it.
There isn’t really any specific code I can show, but basically what happens is:
- Input is recieved by
ContextActionService, which then runs a function that sends a
RemoteEvent to the server.
- When the Server gets the event, it sets that player’s variables (
right) to either
false(depending on whether the player pressed or let go of that button).
- The server changes the player’s
speedvariables depending on which button was pressed
- An infinitely running loop changes the car’s BodyGyro and BodyVelocity depending on the player’s
Originally, while working on the car engine, I tried using a
BodyAngularVelocity object for the chassis, which didn’t end up working due to problems with rotating the car on its local axis. I did make a few posts about it, but they were either ignored or I couldn’t find a solution.
I believe the problem is coming from somewhere in the server. This is because even if the server isn’t catching the player’s input, the car shouldn’t be lagging while the button hasn’t been released. e.g. If I have the
W key pressed, the car might lag and stop while I am driving it. Yet since it hasn’t been released, my
up variable is still set to
true. If I haven’t been clear enough, let me know and I’ll try to explain it better