Help getting the WalkSpeed from the LocalPlayer

How can I get the WalkSpeed from the Localplayer. This is the Localscript I used but it didn’t work, and it didn’t show any error.

LocalScript:

local player = game.Players.LocalPlayer
local char = player.CharacterAdded:wait()
local h = char.Humanoid

script.Parent.Text = h.WalkSpeed
1 Like
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local walkSpeed = 0 -- variable to hold the player's walkspeed

local function UpdateWalkspeed() -- function to update the "walkSpeed" variable
    walkSpeed = humanoid.WalkSpeed
    script.Parent.Text = walkSpeed
end

UpdateWalkspeed() -- set the variable the player's walkspeed
humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(UpdateWalkspeed) -- gets the player's walkspeed when it changes

The character might already be loaded, depending on where the script is.
local char = player.Character or player.CharacterAdded:wait()

1 Like
local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local h = char:WaitForChild("Humanoid")
script.Parent.Text = h.WalkSpeed
1 Like

This should work i tried it:

local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local h = char:WaitForChild("Humanoid")


script.Parent.Text =  tostring(h.WalkSpeed)
2 Likes