I've been trying to make a person's WalkSpeed and Health's Value increase by the Value of the leaderboard ( leader stats ) And this is the Script that I came up with
( Script for health that i made )
local Player = game.Players.LocalPlayer local PlayersEnergy = Player:FindFirstChild('leaderstats'):FindFirstChild('Meme Energy') while true do Player.Character.Humanoid.MaxHealth = PlayersEnergy.Value Player.Character.Humanoid.Health = PlayersEnergy.Value wait(0) end)
( Script for WalkSpeed that i made )
local Player = game.Players.LocalPlayer local PlayersPower = Player:FindFirstChild('leaderstats'):FindFirstChild('Meme Power') while true do Player.Character.Humanoid.WalkSpeed = PlayersPower.Value wait(0) end)
Using while true do
isn't the best way to do this, now assuming this is a local script you should use Changed
instead.
local Player = game.Players.LocalPlayer local PlayersEnergy = Player:WaitForChild('leaderstats'):FindFirstChild('Meme Energy') local char = Player.Character or Player.CharaterAdded:Wait() PlayersEnergy.Changed:Connect(function() char:WaitForChild('Humanoid').MaxHealth = PlayersEnergy.Value end)
local Player = game.Players.LocalPlayer local PlayersPower = Player:WaitForChild('leaderstats'):FindFirstChild('Meme Power') local char = Player.Character or Player.CharacterAdded:Wait() PlayersPower.Changed:Connect(function() char:WaitForChild('Humanoid').WalkSpeed = PlayersPower.Value end)
This should work, if it doesn't check the output and tell me the error.
Good luck on your goal!