Leader board won't show other players WalkSpeed

I found this leader board script that shows players WalkSpeed and I copy-pasted it to my game, but it doesn’t show other players WalkSpeed , it only shows your WalkSpeed.
this is a local script under starter character scripts:

local Char = script.Parent
local Hum = Char:FindFirstChild("Humanoid")

local ls = game.Players.LocalPlayer:WaitForChild("leaderstats")
while wait() do
	ls.zoom.Value = Hum.WalkSpeed
end

and this is a script under server script service:

local Players  = game.Players

Players.PlayerAdded:Connect(function(Player)
	local leaderstats = Instance.new("Folder", Player)
	leaderstats.Name = "leaderstats"

	local WalkSpeed = Instance.new("IntValue", leaderstats)
	WalkSpeed.Name = "zoom"

	Player.CharacterAdded:Connect(function(Char)
		local Humanoid = Char:FindFirstChild("Humanoid")	
		WalkSpeed.Value = Humanoid.WalkSpeed
	end)

end)

I don’t really understand what’s happening, I’ve never touched leader board stuff before, so anything helps.

Thanks

It’s changing it only for the client that did it. That’s why, you need to change it on the server instead.

1 Like

I made it fire a remote event so that should work. But now if you reset your character and your WalkSpeed was 20, it will glitch out between 20 and your current WalkSpeed.

As Stated Above

local Players  = game.Players

Players.PlayerAdded:Connect(function(Player)
	local leaderstats = Instance.new("Folder", Player)
	leaderstats.Name = "leaderstats"

	local WalkSpeed = Instance.new("IntValue", leaderstats)
	WalkSpeed.Name = "zoom"

while wait() do
	local Humanoid = Player.Character:WaitForChild("Humanoid")	
	WalkSpeed.Value = Humanoid.WalkSpeed
	
end
end)
1 Like

please use task.wait().

But for these infinite loops, Just use RunService instead tbh.

probably not the best idea to use task.wait() due to lag and fast update, RunService is not a good idea either since you dont need it to run during Physics and Rendering

How is better function laggy? wait() runs on 30 frames per second whilst task.wait doesn’t lag.
and faster update = better. right?

Thats my point, it updates every 0.03 seconds, barley noticable change, plus its better with detecting player stuff

It’s still better to use task.wait(), it’s not deprecated and faster for changes like walkspeed detections.

Use GetPropertyChangedSignal("WalkSpeed"), It’s much better and it saves resources.

I put this in the script under sever script service, right?

Yes, Make sure you do

Char

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.