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

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

Asked by 8 years ago

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

Log in to vote
2
Answered by 8 years ago

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
Ad

Answer this question