I have been trying to make the characters speed and highest ever speed show on leaderstats but I cannot get it to work:
game.Players.PlayerAdded:Connect(function(player)
local character = player.Character
local leaderstats = Instance.new("BoolValue",player)
leaderstats.Name = "leaderstats"
local Speed = Instance.new("IntValue", leaderstats)
Speed.Name = "Speed"
local HighestSpeed = Instance.new("IntValue", leaderstats)
HighestSpeed.Name = "HighestSpeed"
Speed.Value = 0
HighestSpeed.Value = 0
while true do--this is where it could stop working
task.wait()--or maybe here
Speed.Value = character.Humanoid.WalkSpeed--probably here
if Speed.Value > HighestSpeed.Value then
HighestSpeed.Value = Speed.Value
end
end
end)
The while true do loop does not run
If anyone has a solution I would love the help!

5 comments
On line 18, you just typed; Speed.Value = Character.Humanoid.Walkspeed. You did not define the player in a variable nor the character. On the very top of you script, try making a variable that defines the player, and a variable that defines the character.
I dont know if this is the problem, but try it.
that isn't the problem. He might not be using the output so really they need to put character:WaitForChild('Humanoid') since it is playeradded and not characteradded
That didn't work greatniel80
In that case you are using a localscript, use a regular script and parent it to workspace instead. The PlayerAdded wasn't working to begin with since it is a localscript, I probably should've mentioned this earlier