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

How to make one script make another stop using _G?

Asked by
gecko95 20
10 years ago

I know what global function is but i dont know how to use it to make a script make another one stop or start running

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

Just check before doing anything.

If you have a function with some constant loop, you can check that the global variable says it's okay:

while wait(1) do
    if _G.okay then
        -- Do whatever
    end
end

Similarly, for any events that you have going on.

function onTouched(hit)
    if _G.okay then
        -- Do whatever
    end
end
blah.Touched:connect(onTouched);
Ad

Answer this question