Is there a way to display the speed a player moving at a better way?

What I am trying to go for is simple in hindsight, but when I attempted doing didn’t work. I am trying to display the speed a player is moving at. I know that you can see the speed every time the player runs by doing

local label = script.Parent.Label
humanoid.Running:Connect(funtion(s)
label.Text = s
end)

but it won’t update when the speed changes. So I tried changing it every frame, which just made the game lag. Any help?

Try this:

-- // Services (Declare required services)
local Players = game:GetService("Players")

-- // Variables
-- Declare all player-related variables
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait() -- If player.Character equals nil, wait for CharacterAdded event
local humanoid: Humanoid = character:WaitForChild("Humanoid")

local textLabel = script.Parent

-- // Functions
local function UpdateLabel(speed)
	textLabel.Text = speed
end

-- // Connections
humanoid.Running:Connect(UpdateLabel) -- Connect .Running to the local function