So roblox has this thing, that shows you a headsupdisplay, whenever you drive that seat. Its basically just a speedometer.
local VehicleSeat = script.Parent VehicleSeat.HeadsUpDisplay = true
I need to get the speed of the seat somehow, and use it in a variable. I was just wondering , If I can somehow use the data for the HeadsUpDisplay, for like a variable.
TLDR: I want to measure the speed of a VehicleSeat using a Variable
Please mark this as solved.
I had a quick look at the Jeeps roblox has for one of it's studio templates that uses the headsupdisplay
I originally thought that there was a maybe a read only variable already part of it but apparently not.
You can though use something like this:
local Speed = script.Parent.DriveSeat.Velocity.Magnitude
The downside is that it returns a float (a decimal) So you'll end up with extremely long numbers like 79.9746372845. I recommend you use some rounding to fix that though.
Edit:
I did just double check this and made a little line of code for printing it.
Since you can't print a float or an integer remember to convert to string first with tostring()
print(tostring(Speed))
Edit2:
If it is returning 0 here is what I suggest: Create a new script inside the drive seat with the following code:
while true do wait(1) print(tostring(script.Parent.Velocity.Magnitude)) end
And make sure your driving the vehicle! Else your number will stay at 0 because your not moving!