I searched this question on google, but instead, showed me how to FIRE multiple functions and not WAIT for multiple functions to fire.
My goal is to see if a function fired out of two functions. If both functions fired at the same time somehow, then it will continue the program. If one function fires, but not the other, then it will continue the program. If no functions fire, then keep waiting for one of them to fire.
Here's the code:
local guiPopUpEvent = game.ReplicatedStorage.OpenIslandThingyThingThing
local guiClosedEvent = game.ReplicatedStorage.CloseIslandThingyThingThing
local islandSwitchGUI = script.Parent
local click = islandSwitchGUI.Click
guiPopUpEvent.OnClientEvent:Connect(function(plr)
if not islandSwitchGUI.Enabled then
islandSwitchGUI.Enabled = true
click:Play()
spawn(islandSwitchGUI.Close.CloseButton.MouseButton1Click:Wait())
spawn(islandSwitchGUI.GO.Button.MouseButton1Click:Wait())
-- Continue program
end
end)
I got this error when it ran:
Spawn function requires 1 argument - Client - Show&Hide:12
(Show&Hide is the script name)

7 comments
Spawn will open a new thread to execute the passed function as a Callback. 'MouseButton1Click' is an RBXScriptSignal, which you've called the 'Wait' method on to yield for results. That was already appropriate.
Simply un enclose the lines from the Spawn functions.
What do you mean by "un-enclose"?
I don't really know about the spawn function. I just read a little stuff about it and did something.
Remove the spawn function.
Removing the spawn function will make it wait for both functions to fire, but I want it to wait for ONE function to fire, not two.
I solved it! But thanks for the help!