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

How do I make my script check if it is frozen?

Asked by 10 years ago

My script seems to always work fine, but at some points it freezes for unknown reasons. It freezes at this point of the main script:

h.Text = "New round will begin soon..."
    wait(3)
    h.Text = "Choosing random game..."
    wait(3)

So in order to restart the entire game/script I created another script, but this script isn't working at all. This script's only goal is to regen the entire game.

Could anyone tell me what exactly I need to fix?

local regen_track = game.ReplicatedStorage
while script.Disabled == false do
wait(15) -- time before checking if game is broken
if workspace.Hint.Text == "Choosing Random game" then
local function delete(parent)
    for i,v in pairs(dlt) do 
        local object = parent:findFirstChild(v)
        if object then 
            object:Destroy()
        end
    end
end

regen_track.Changed:connect(function()
    if regen_track.Value >= needed and not regening then
        regening = true
        game.Teams:ClearAllChildren()
        delete(Workspace)
        script.Parent.Disabled = true
        wait(1)
        script.Parent.Disabled = false
        regen_track.Value = 0
        regening = false
    end
end)

script.Disabled = true

end
end

Answer this question