Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Scripts crashing my ROBLOX Player?

Asked by 10 years ago

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

Log in to vote
3
Answered by
RedCombee 585 Moderation Voter
10 years ago

Change all your while loops to:

while wait() do
0
They're all crashing you, by the way, so you have to fix all three. RedCombee 585 — 10y
0
That worked, thanks! SlickPwner 534 — 10y
0
No problem. RedCombee 585 — 10y
0
I call those rogue while loops Tempestatem 884 — 10y
Ad
Log in to vote
0
Answered by
Vividex 162
10 years ago

RedCombee's method works, but I usually put a

wait()

at the end of all my loops which prevents any crashes.

Log in to vote
0
Answered by 5 years ago

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.

Answer this question