game.Players.PlayerAdded:Connect(function(player)
while true do
if player:WaitForChild("PlayerData"):WaitForChild("xpProg").Value == player:WaitForChild("PlayerData"):WaitForChild("xpReq").Value then
player.PlayerData.xpProg.Value = 0
player.PlayerData.xpReq.Value = player.PlayerData.xpReq.Value * 2 + 1000
player.leaderstats.Level.Value = player.leaderstats.Level.Value + 1
end
end
end)
This is a script that when a player reaches the required xp to level, reset xpProg and set xpReq to be higher. However, when I try and test the script in studio, the client freezes and errors in output with script exhaustion: allowed execution time and leads me to line 5. How do I fix this, since I don't know how.

1 comment
no wait(), put one after line 2