I edited a few scripts, and now when I test Solo or join the game, I crash, and I'm not sure why. Can someone let me know what's going wrong with my scripts, so I can fix it? I've concluded that it must be one of these 3 scripts, as those are the ones I updated. 1st script:
Player = game.Players.LocalPlayer repeat wait() until Player wait(3) while true do script.Parent.Text = "Player Level: "..Player.leaderstats.PlayerLevel.Value end
2nd:
Player = game.Players.LocalPlayer repeat wait() until Player wait(3) while true do script.Parent.Text = "HP: "..Player.Health"/"..Player.leaderstats.HP.Value Player.MaxHealth = Player.leaderstats.HP.Value end
3rd:
Player = game.Players.LocalPlayer repeat wait() until Player wait(3) while true do script.Parent.Text = "Total Exp Gained: "..Player.leaderstats.Exp.Value end
Change all your while loops to:
while wait() do
RedCombee's method works, but I usually put a
wait()
at the end of all my loops which prevents any crashes.
In all of your scripts:
Push Ctrl+H
.
Then add this to the top box:
while true do
And this code in the bottom box:
while (wait() or yourCondition)
, replacing yourCondition
with your while loop condition, in this case change it to true
.