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

Fire is not a valid member of RBXScriptSignal??

Asked by 6 years ago

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?

1 answer

Log in to vote
1
Answered by 6 years ago

It means that the .Event you have is of the class RBXScriptSignal. If you check out that wiki link, you will notice that there is no such thing as "Fire" in it -- only "Wait" and "Connect" ("connect" is deprecated, so you should stop using it).

If Error_State is a BindableEvent, simply call ":Fire" on it: script.Error_State:Fire("Return")

Do note that just because your script responds to this BindableEvent doesn't mean that it's still working. Since events start their listeners in new coroutines every time, it will likely always fire the "Return" value (unless it died before it got to that point). Instead, if your script uses a while true do loop, you may want it to continually adjust an IntValue and have your "has it crashed?" script assume that if the IntValue stops updating for more than some period of time (ex a fraction of a second or whatever is reasonable), that it has crashed.

0
Would I be able to do spawn(function(x) while true do ? CherryLeaves 32 — 6y
0
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. chess123mate 5873 — 6y
Ad

Answer this question