Why is my velocity display not updating?

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to make an Air Speed Indicator for my HUD.

  2. What is the issue? Include screenshots / videos if possible!
    Whenever I run the test the Velocity displayed doesn’t seem to change. It works for like one frame and then stops. I’m using the run service so I know its being continuously called. Print statements prove it. No errors either.

image

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried using the run service but clearly that doesn’t work right.

This is all the code Im using for this

local player = game.Players.LocalPlayer
local RS = game:WaitForChild("Run Service")

local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local VelocityVector = character.PrimaryPart.AssemblyLinearVelocity

local AS = script.Parent.AS

RS.RenderStepped:Connect(function()
	local Velocity = VelocityVector * Vector3.new(1,1,1)
	
	AS.Text = tostring(Velocity.Magnitude).." KM/H"
	print("Running")
end)

Ok first of all, what does this achieve?

Why do you need to multiply by one? It just stays the same

From another post I’m pretty sure it just allows me to have all axis’ of velocity

No it won’t. Imagine the vector is not compacted

local x = 2
local y = 5
local z = 0

then you multiply it with the Vector3.new(1,1,1)

x = x * 1
y = y * 1
z = z * 1

It does not make sense. You multiplied by one which returns the same value

Anyways, you said it only runs once? Like the

is not printing?

The print statements run as its supposed to but the velocity just doesnt seem to update

aight I pulled a big dumb my bad

Oh wait I found the reason.

It takes the value, but it does not account for change in value so the variable stays the same. What you should do instead is this

local PrimaryPart = character.PrimaryPart
...
RS.RenderStepped:Connect(function()
	local Velocity = PrimaryPart.AssemblyLinearVelocity