Hello. I am trying to make an advanced airplane model, and it will have similar instruments to the ones on a real life plane. I am right now making the altimeter, but I ran into a roadblock. I have gotten the altimeter to say the part's height, but I cant get it to round. This is a very crucial part to the airplane because once autopilot is put in, it will need to have the altimeter numbers rounded as a whole. (Please note the altimeter's height is recorded through a number value).
Currently, the altimeter works like this: Altitude: 14597.826
How I need it to work: Altitude: 14597
Thanks
I solved it myself with a script. Here it is: ActualAltitude is what the altimeter is showing without rounding while true do local ActualAltitude = script.Parent.Value function Round(Number, Decimals) Decimals = (Decimals > 0 and Decimals or 0) Number = Number*(10^Decimals) local rNum, Dec = math.modf(Number) if Dec >= .5 then rNum = rNum + 1 end return rNum/(10^Decimals) end
script.Parent.Value = (Round(ActualAltitude, 0)) wait()
end