Speed and altitude meter

Hello developers, I am trying to make a GUI show the altitude and speed of a certain part, I’ve tried this and it doesn’t seem to work has anyone else got another suggestion I could try?

I’ve tried doing this so far;

local main = script.Parent.Parent.Parent.VALUE.Value
local value = main:WaitForChild("Altitude")

while true do
	wait(0000000000000000000000000000000000000000.1)
	script.Parent.Text = "Altitude: "..value.Value
end

wait() minimum is 0.03 seconds, it will automatically get set to 0.03 instead of that number you put in. You should be using a changed event on the Value instead of a while loop

1 Like

Are you sure that you’re correctly addressing the path to the Value? It seems that you’ve used .Value twice, and you may had got confused there. I’d also advise to use while wait() do instead for a clean-up.

1 Like

This is unnecessary, just use wait() without any numbers to create a delay, or even better:

while wait() do
     script.Parent.Text = "Altitude: "..tostring(value.Value)
end

I’ve just tried this, and it doesnt seem to work. I replaced

while true do
	wait(0000000000000000000000000000000000000000.1)
	script.Parent.Text = "Altitude: "..value.Value
end

With

while wait() do
     script.Parent.Text = "Altitude: "..tostring(value.Value)
end
```.

Why does it not work? Does it error or does it just not work?

There isnt anything in the output, and the GUI wont show a number it just says 0.

you should do something like this:

game:GetService("RunService").Heartbeat:Connect(function()
	script.Parent.Text = "Altitude: "..value.Value
end)

This way you run it every frame, and there is no waits involved.

in addition to this, you can just get the Y position of the part:

game:GetService("RunService").Heartbeat:Connect(function()
	script.Parent.Text = "Altitude: "..Part.Position.Y
end)

P.S. If you want it to be less precise, you can do math.floor(Part.Position.Y) to round the number down instead of doing Part.Position.Y

Strange, for some reason that doesn’t work.

Did you change the part value to whatever the part you are tracking is?