(A-CHASSIS) Speedometer in part not working

So, basically, what I want to do, is a speedometer in a part, but it doesn′t change itself, not working like the one I made (screen speedometer)…

Here is the code for the speedometer on screen (LocalScript):

local UNITS = {								--Click on speed to change units
	--First unit is default	
	{
		units			= "km/h"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 120				,
		spInc			= 20				, -- Increment between labelled notches
	}
}
local currentUnits = 1
local values = script.Parent.Parent.Parent.Parent.Values
while true do
	wait(1/60)
	script.Parent.Text = math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end

And here is the code I am using for the part (Script):

local UNITS = {								--Click on speed to change units
	--First unit is default	
	{
		units			= "km/h"			,
		scaling			= (10/12) * 1.09728	, -- 1 stud : 10 inches | ft/s to KP/H
		maxSpeed		= 120				,
		spInc			= 20				, -- Increment between labelled notches
	}
}
local currentUnits = 1
local values = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent["A-Chassis Tune"]["A-Chassis Interface"].Values
while true do
	wait(1/60)
	script.Parent.Text = math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end

Hi,
Instead of taking the speed from the values, try taking the speed from the car seat.
…DriveSeat.Velocity.Magnitude

2 Likes

Seems to be working:

I′ll edit the appearance…

You can still use the old script just replace
values.Velocity.Value.Magnitude with …DriveSeat.Velocity.Magnitude

Then the values ​​should be displayed normally.

After I edited the appearance, it looks like this:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.