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

i cant seem to prevent game script timeout (?)

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by
Psudar 882 Moderation Voter
4 years ago
Edited 4 years ago

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

0
didnt fix it either RazerGaming2312 3 — 4y
0
wait, it did fix the game script timeout, but it didnt start the script it enabled RazerGaming2312 3 — 4y
Ad

Answer this question