Sorry if the title was kinda confusing, I didn't know how to put it any other way.
I'm trying to make a speedometer for a car and I can get the speed to be printed out as fast as I want, but when I try to change the GUI's text it stays at 0.
I have a NumberValue in my VehicleSeat along with my script, thats what I'm referring to as Speedometer.
I was wondering how I can make the GUI update in a way, like when I press W it doesn't stay at 0 it accelerates up to however fast you go.
Hope you can help, heres my code.
local sp = script.Parent
local speedometer = script.Parent.Speedometer.Value
while wait() do local speed = math.floor(sp.Velocity.Magnitude + 0.5)
speedometer = speed
print(speedometer)
game.StarterGui.ScreenGui.TextLabel.Text = speedometer
wait(0.1)
end

1 comment
It is much cleaner in this format. You should accept this answer.