pr = nil

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
 while true do
 local val = plr.leaderstats.Energy.Value
      pr = 1  
      
 local human = char:WaitForChild("Humanoid")
  human.WalkSpeed = val / 10
 
 if human.WalkSpeed == 0 then
  human.WalkSpeed = 4
 end
  human.JumpPower = 0 
  wait(2)
end
end)
end)

This is a script someone fixed for me on one of my other posts. There is a problem with it. Once the forever runs once, it doesn't run again.

This script is located on the server (serverscriptservice to be exact). I can't figure out what's wrong with it so thank you if you do!