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
When you join the ScreenGui changes its parent to the PlayerGui, fx. like the StarterCharacterScripts contents comes in the character of course.
This is in a local script, parent the localscript to the screenGui. -- IMPORTANT
local sp = -- where it is located local speedometer = -- where the speedometer is located while wait() do local speed = math.floor(sp.Velocity.Magnitude + 0.5) speedometer = speed print(speedometer) script.Parent.TextLabel.Text = speedometer wait(0.1) end