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

How to make fail safe script work better?

Asked by
ItsMeKlc 235 Moderation Voter
8 years ago

I made this script which basically clones the game script if it stops working. Thing is sometimes it randomly resets... So I need help making a script that resets if the timer stays still for a while

wait()
local fix = script.Parent:Clone()
fix.Parent = game.ServerStorage.assets
script.Parent.Disabled = false
function change()

    local value = script.Parent.Parent.timer.Value
    local test = value
    wait(34.4231123)

    if script.Parent.Parent.timer.Value == test then
        print("BROKEN")
        local newmain = game.ServerStorage.assets.main
        newmain.Parent = game.Workspace.game
        script:Destroy()

    else

    end

end

script.Parent.Parent.timer.Changed:connect(change)

Answer this question