@MajorMajesticPie's answer is correct, but I just want to change something.
local leaderstats = game.Players.LocalPlayer:WaitForChild("leaderstats")
local speed = leaderstats:WaitForChild("speed")
script.Parent.Text = speed.Value
speed.Changed:Connect(function(changedPropertyName)
if changedPropertyName == "Value" then
script.Parent.Text = speed.Value
end
end)
Alternatively, you can use the player's humanoid walkspeed.
local function waitForChildWhichIsA(className, instance)
local found = nil
repeat
task.wait()
found = instance:FindFirstChildWhichIsA(className)
until found ~= nil
return found
end)
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = waitForChildWhichIsA("Humanoid", character)
script.Parent.Text = humanoid.WalkSpeed
humanoid.Changed:Connect(function(changedPropertyName)
if changedPropertyName == "WalkSpeed" then
script.Parent.Text = humanoid.WalkSpeed
end
end)
1 comment
can you try explaining it?