I want to be able to know when one of my core-scripts stops responding. I have this code in one script:
(MAIN SCRIPT)
-- Error State
script.Error_State.Event:connect(function(x)
if x == "Check" then
script.Error_State.Event:Fire("Return")
end
end)
And this is the code for the other script
local Alive = true
local ErrorState = false
wait(5)
game:GetService('RunService').Heartbeat:connect(function()
if ErrorState == false then
Alive = false
script.Parent.Error_State:Fire("Check")
wait(0.1)
if Alive == false and ErrorState == false then
game.ReplicatedStorage.Abscond_Materials.Abscond_Event:FireAllClients("Alert","The Abscond System crashed unexpectedly(script stopped responding). Please wait while the system tries to recover. Your in-game experience may be interrupted.","The Abscond System.")
ErrorState = true
end
end
if Alive == true and ErrorState == true then
game.ReplicatedStorage.Abscond_Materials.Abscond_Event:FireAllClients("Notification","The Abscond System crashed unexpectedly and successfully recovered. Thank you for your patience.","The Abscond System.")
ErrorState = true
end
end)
script.Parent.Error_State.Event:connect(function(x)
if x == "Return" then
Alive = true
end
end)
I've tried to add waits, etc, but that doesn't seem to be working.
Whenever the MainScript tries to fire the event it says "Fire is not a valid member of RBXScriptSignal" - what does this mean? How do I fix it?

2 comments
Would I be able to do spawn(function(x) while true do ?
That lets you run a while-true-do loop in its own coroutine, but if you just have one loop, that's unnecessary. I simply meant: inside that while loop, keep changing an IntValue. In another script, if that IntValue ever stops changing for more than a second, you'll know that the while loop ran into an error.