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

Why is this basic one-person-only GUI script crashing ROBLOX Studio?

This script is simple. It's a GUI scoreboard for a soccer stadium that partners with another script which says to let only "Player1" see the GUI and make changes to the TextBoxes seen in this script. This script, when disabled, will let Test Mode run while the other script is running. When not disabled, Test Mode won't load up. I'm tired and confused, so I'd appreciate it if someone would help me out.

wait(10)
a = script.Parent.Home.TeamName.Text
b = script.Parent.Home.Score.Text
c = script.Parent.Away.TeamName.Text
d = script.Parent.Away.Score.Text
while true do
	game.StarterGui.Score.Home.Text = a .. ": " .. b
	game.StarterGui.Score.Away.Text = c .. ": " .. d
end
wait(10)
script.Disabled = true
script.Disabled = false

1 answer

✓ Accepted answer

You forgot wait() without it the while functions run infinitly fast crashing the studio.

wait(10)
a = script.Parent.Home.TeamName.Text
b = script.Parent.Home.Score.Text
c = script.Parent.Away.TeamName.Text
d = script.Parent.Away.Score.Text
while true do
wait()
    game.StarterGui.Score.Home.Text = a .. ": " .. b
    game.StarterGui.Score.Away.Text = c .. ": " .. d
end
--anything after this wont work because above is an infite loop
wait(10)
script.Disabled = true
script.Disabled = false

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