Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Showing speed in a text label?

Asked by 6 years ago

I'm trying to show a players speed in a TextLabel in a gui. I have written a script, but it doesn't work.

local plr = game.Players.LocalPlayer
local Character = plr.Character

Speed = math.floor(Character.HumanoidRootPart.Velocity.magnitude + 0.5) 
script.Parent.Text = Speed

1 answer

Log in to vote
0
Answered by 6 years ago
--LocalScript
local ply = game.Players.LocalPlayer
local char = ply.Character
local root = char:FindFirstChild("HumanoidRootPart")

local run = true

while run do
    local speed = math.floor(root.Velocity.magnitude + 0.5)
    script.Parent.Text = tostring(speed)
    wait()
end
0
Thanks bro :) CarlPlandog 20 — 6y
Ad

Answer this question