Speedometer UI for boat

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?

Roblox Standard speedometer UI
https://gyazo.com/1eb8389f57fcbda0fe0a98f383b713e5

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.

4 Likes

Add a normal VehicleSeat to the boat for the driver to sit in. I believe that if you change its velocity via script, the UI should update.

2 Likes

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.

4 Likes

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:

4 Likes