local C=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local G=C:WaitForChild("\070\111\114\098\105\100\100\101\110")local U=G:WaitForChild("\077\117\108\116\105\112\108\097\121\101\114")local H=U:WaitForChild("\081\117\101\117\101")local z=H:WaitForChild("\115\105\103\110\097\108\115")local R=z:WaitForChild("\106\111\105\110")local q=z:WaitForChild("\108\101\097\118\101")local B=z:WaitForChild("\116\111\067\108\105\101\110\116\077\097\116\099\104\073\110\102\111")local O=script.Parent local T=0 local Z=false local r=false local X=false local function b(C) end local function y() end local function I() end local function L()if X then return end X=true R:InvokeServer()y()X=false end local function Q()if X then return end X=true task.wait(T)q:InvokeServer()I()X=false end local function Y()if Z then Z=false r=true Q()end if r then r=false return end if not Z then Z=true L()end end O.MouseButton1Up:Connect(Y)B.OnClientEvent:Connect(b)
-- Services
local rs = game:GetService("ReplicatedStorage")

-- Referencing
local int_Forbidden = rs:WaitForChild("Forbidden")
local multiplayer = int_Forbidden:WaitForChild("Multiplayer")
local queue = multiplayer:WaitForChild("Queue")

local signals = queue:WaitForChild("signals")
local join = signals:WaitForChild("join")
local leave = signals:WaitForChild("leave")
local matchmade = signals:WaitForChild("toClientMatchInfo")





-- USER OPTIONS BELOW 
-- USER OPTIONS BELOW 
-- USER OPTIONS BELOW 
-- USER OPTIONS BELOW 
-- USER OPTIONS BELOW 




-- Settings
local button = script.Parent
local TimeToLeaveQueue = 0 -- Change if you want the player to wait (x) seconds before the leave request is sent to the server



local queuing = false
local db = false
local db2 = false




local function MatchFound(players) -- players is a table of all players (including this player)
	
	--button.Visible = false -- example
	
end

local function JoinRequestSent()
	
end

local function LeaveRequestSent()

	-- your code here
end











------------------------------------------------------------------------------
--FORBIDDEN----FORBIDDEN----FORBIDDEN----FORBIDDEN----FORBIDDEN----FORBIDDEN--
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--FORBIDDEN----FORBIDDEN----FORBIDDEN----FORBIDDEN----FORBIDDEN----FORBIDDEN--
------------------------------------------------------------------------------
------------------------------------------------------------------------------
--FORBIDDEN----FORBIDDEN----FORBIDDEN----FORBIDDEN----FORBIDDEN----FORBIDDEN--
------------------------------------------------------------------------------


-- required

local function Join()
	
	if db2 then return end
	

	db2 = true
	join:InvokeServer()
	JoinRequestSent()
	db2 = false
end

local function Leave()
	
	if db2 then return end
	
	db2 = true
	task.wait(TimeToLeaveQueue)
	leave:InvokeServer()
	LeaveRequestSent()
	db2 = false
end

local function onPress()
	
	if queuing then
		
		queuing = false
		db = true
		Leave()
	end
	
	if db then db = false return end
	
	if not queuing then
		
		queuing = true
		Join()
	end
end

button.MouseButton1Up:Connect(onPress)
matchmade.OnClientEvent:Connect(MatchFound)