How to tie a player stat into a leaderstat

Hello, I’m trying to create a script which will change player speed, but I would like to use leaderstats to change the player speed. I’m not too experienced so any help would be appreciated. Thanks :slight_smile:

You could just make it so that when you set their speed, you set their leaderstat’s player speed as the same value.

You could make a leaderstats value and make the Player’s Speed the same value as the leaderstat value, sort of like this:

—Creating stats [Server Script]
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new(“Folder”, plr)
folder.Name = “leaderstats”

local speed = Instance.new(“IntValue”, folder)
speed.Name = “Speed”
end)

—Making the Player’s speed the same as the leaderstat speed value [Local Script]
local plr = game.Players.LocalPlayer
local workspaceplr = game.Workspace:FindFirstChild(plr.Name)
workspaceplr.Humanoid.WalkSpeed = plr.leaderstats.Speed.Value