I have multiple scripts and each one with multiple textbuttons and uses the event

script.Parent.MouseButton1Down:connect(function()
--Do stuff
end)

My game has to use a lot of datastore SetAsync and GetAsync to run, so right now I'm trying to get all the MouseButton1Down events to automatically check to see if an IntValue called "Saves" and "Loads" is 0 and if it is continue if not just stop running and wait for a click when Saves and Loads are 0. There's tons of MouseButton1Down events and I don't want the first thing in each one to have to be if(saves.Value==0 and loads.Value==0)then end Is there some way to make it only keep running the script only if the values are 0 without having to include that line after each event?

2 comments

0

Without editing each and every one of your scripts (which I assume is what you don't want to do), this is not possible from my knowledge. But you never know, I might be wrong!

0

What about putting it in each script but not putting it inside each MouseButton1Down