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

i cant seem to prevent game script timeout (?)

im making a tutorial and want to go to the next information only when the previous info was used, in this case til the user clicks a cube, but every time it gets to that point and i click the cube, studio stops responding for a little bit and it says "game script timeout" and just doesnt work. it was fine and worked well til i added the "repeat" part

local text = "To start, Left Click the cube."
game.Workspace.Map.TutorialRestriction.Invis1.CanCollide = false
script.Parent.Tutorial.Click.Playing = true
for i = 1, #text do
    script.Parent.Tutorial.Gui.TextLabel.Text = string.sub(text, 1, i)
    wait(0.0625)
end
if text ==  "To start, Left Click the cube." then 
	script.Parent.Tutorial.Click.Playing = false
	repeat
	if game.Workspace.Interactables.Cube.Anchored == false then
		script.Parent.Tutorial6.Disabled = true
	end
	until script.Parent.Tutorial6.Disabled == false
end

1 answer

✓ Accepted answer

It's probably because you're not yielding during that repeat loop.

This should be enough to fix it.

local function disable()
	if not game.Workspace.Interactables.Cube.Anchored then
		script.Parent.Tutorial6.Disabled = true
	end
end

repeat disable(); wait()
until script.Parent.Tutorial6.Disabled == false

--ps: just rearranged it a bit to look nicer

2 comments

0

didnt fix it either

0

wait, it did fix the game script timeout, but it didnt start the script it enabled

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