Making a 2 option wait?

does anyone know how can i make 2 option wait? like if the option 1 has already finished then it won’t wait for option 2 anymore. script i made is

script.start.Changed:Wait() or game.ReplicatedStorage["autovote(20d2u8djdwd2)"].OnServerEvent:Wait()

but it isn’t really working because of “or” and if i remove or “game.ReplicatedStorage[“autovote(20d2u8djdwd2)”].OnServerEvent:Wait()” is now the problem.

local Fired = false
local connection, connection2

connection = script.start.Changed:Connect(function()
	Fired = true
end)

connection2 = game.ReplicatedStorage["autovote(20d2u8djdwd2)"].OnServerEvent:Connect(function()
	Fired = true
end)

while not Fired do
	task.wait()
end

connection:Disconnect() 
connection2:Disconnect()

-- your code
1 Like
local fired, connection, connection2 = false, nil, nil

local function switchState()
	fired = true
	connection:Disconnect() 
	connection2:Disconnect()
end

connection = script.start.Changed:Connect(switchState)
connection2 = game.ReplicatedStorage["autovote(20d2u8djdwd2)"].OnServerEvent:Connect(switchState)

while not fired do
	task.wait()
end