How can I improve/rewrite my car system?

I’m trying to build a car system which turns based on VehicleSeat.SteerFloat, throttles based on VehicleSeat.ThrottleFloat, and brakes based on the spacebar. It also all has to be in a module.

I’m having issues making this script efficient, as in, my script is cluttered, laggy, hard to understand, and generally feels bad.

I have tried changing from UserInputService.InputChanged to UserInputService:IsKeyDown, but since the entire driving functions currently runs from VehicleSeat.Changed, that’s hard to implement.

I’m relatively new to scripting. Any information on how this should be done would be appreciated. I don’t even know where I should put what for setting up a car system and may just rewrite everything so far.

1 Like