I have a vehicle system, that works on the client, every hinge and wheel are rotated on the client.
So I’m using networkOwner.
But; I also want to add a FUEL system so you need to charge fuel.
The main issue with this would be that, since it runs on the client, it could be exploitable so, my options for me would be;
have the fuel on an attribute (on server) and run it on the client and when it ran out of gas no driving is allowed in the client
have the fuel on an attribute (on server) and run it on the client and when it ran out of gas no driving is allowed in the client but, Make the car come to a stop and if the car eventually moves without gas kick the player…
im not sure but i think attributes are replicated but if its not you can do that.Other way would be remote functions maybe where you fire a remote func every time player moves the car and then get the fuel data back and in the local script when it gets the fuel data you can check if its more than 0 then move the car but pretty sure it will get a bit input lag probably
Have an int value in the vehicleseat of the vehicle.
Use a server script that checks the speed of the vehicleseat & throttle.
If the player is moving the vehicle (Throttle ~= 0) lower the int value. (If you want to, write a mathematical calculation so higher speeds burn more fuel.)
Have the server script mentioned before disable the vehicleseat once the fuel is at 0. When the vehicleseat is disabled, it will kick the user from the seat, subsequently rendering the vehicle useless, as the user cannot exploit the serversided fuel value nor re-enable the seat as the vehicle will then transition to having the server take network ownership.