Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Scripts crashing my ROBLOX Player?

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

3 answers

✓ Accepted answer

Change all your while loops to:

while wait() do

4 comments

0

They're all crashing you, by the way, so you have to fix all three.

0

That worked, thanks!

0

No problem.

0

I call those rogue while loops

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.