I made a small bit of code to track a player's speed, but whenever the player resets, the code still runs, but the gui doesn't update anymore
Code:
local Players = game:GetService("Players")
local runservice = game:GetService("RunService")
local player = Players.LocalPlayer
local playerGui = player.PlayerGui
local ingamePlayer = workspace:WaitForChild(tostring(player))
local HumanoidRootPart = ingamePlayer:WaitForChild("HumanoidRootPart")
local speedUi = playerGui:WaitForChild("SpeedGUI").Frame.SpeedValue
runservice.Stepped:Connect(function()
speedUi.Text = tostring(math.round(HumanoidRootPart.AssemblyLinearVelocity.Magnitude))
end)