Hey everyone, I’m currently working on a boat model and I’m attempting to make the boat use a custom speedometer UI, instead of the roblox default one (see below). Any way I’d use the same mechanics of the vehicle seat mechanism if I used different UI for it?
Looking for a script to change the UI and make it have the same mechanics as the roblox one, starting out scripting advanced things here (primarily a builder myself).
If anyone could post the script and explain in enough detail how it works, would be very helpful to me. If you need any information on my current scripting base for the boat, let me know.
Disable the UI in the vehicle seat, and use a LocalScript to read the magnitude of the player’s torso or head and divide that by your upper speed limit to create a fraction. You can then use this fraction to scale your speedometer.
The speed bar in the VehicleSeat Gui is calculated by getting the velocity of the VehicleSeat and dividing that by a couple numbers, including the maximum speed of the VehicleSeat. This is put in a function which listens to RunService.Heartbeat.
If you need a script reference for how this is done, here is the CoreScript that creates and manages the VehicleSeat Gui. I don’t really have the time or device to explain but a lot of it should be self explanatory if you understand how to write code: