Can someone help me with a ticket system?

I am currently making like a ticket system and I don’t really know how to script what I am trying to achieve.

How it works right now: So, when I press A/B/C/DBlack2 it will change the number on the board, and the buzzer is when you press it, it will play a sound. And the close button is to close the room basically changing the text on the board from the number to “CLOSED”.

What I am trying to achieve now (adding on to above): It will only change the board if you click A/B/C/DBlack2 when someone has a ticket/card that has the number on it that should is the next number when you click A/B/C/DBlack2.

Script
Control = script.Parent.Control

ABlack2 = script.Parent.ABlack2
BBlack2 = script.Parent.BBlack2
CBlack2 = script.Parent.CBlack2
DBlack2 = script.Parent.DBlack2

BuzzerA = script.Parent.BuzzerA
BuzzerB = script.Parent.BuzzerB
BuzzerC = script.Parent.BuzzerC
BuzzerD = script.Parent.BuzzerD

CloseA = script.Parent.CloseA
CloseB = script.Parent.CloseB
CloseC = script.Parent.CloseC
CloseD = script.Parent.CloseD

-------------------------
t = 1000
Counter1 = script.Parent.Parent.TV.Room1
Counter2 = script.Parent.Parent.TV.Room2
Counter3 = script.Parent.Parent.TV.Room3
Counter4 = script.Parent.Parent.TV.Room4


Button1 = script.Parent.RealScreen1.Screen.Normal.Next
Button2 = script.Parent.RealScreen2.Screen.Normal.Next
Button3 = script.Parent.RealScreen3.Screen.Normal.Next
Button4 = script.Parent.RealScreen4.Screen.Normal.Next

-------------------------

script.Parent.ABlack2.ClickDetector.MouseClick:Connect(function(Player)
	if Player.Team.Name == "Medical Staff" then
		t += 1
		Counter1.SurfaceGui.TextBox.Text = t
		script.Parent.Parent.TV.Room1.SurfaceGui.TextBox.Text = t 
		Button1.Text = t 
		Control.Dong.Playing = true
		wait(1)
		Control.Dong.Playing = false
	end
end)

script.Parent.BBlack2.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then
		t += 1
		Counter2.SurfaceGui.TextBox.Text = t
		script.Parent.Parent.TV.Room2.SurfaceGui.TextBox.Text = t
		Button2.Text = t
		Control.Dong.Playing = true
		wait(1)
		Control.Dong.Playing = false
	end
end)

script.Parent.CBlack2.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then
		t += 1
		Counter3.SurfaceGui.TextBox.Text = t
		script.Parent.Parent.TV.Room3.SurfaceGui.TextBox.Text = t
		Button3.Text = t
		Control.Dong.Playing = true
		wait(1)
		Control.Dong.Playing = false
	end
end)

script.Parent.DBlack2.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then
		t += 1
		Counter4.SurfaceGui.TextBox.Text = t
		script.Parent.Parent.TV.Room4.SurfaceGui.TextBox.Text = t
		Button4.Text = t
		Control.Dong.Playing = true
		wait(1)
		Control.Dong.Playing = false
	end
end)

script.Parent.BuzzerA.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then 
		Control.Dong.Playing = true 
		wait(1)
		Control.Dong.Playing = false 
	end
end)

script.Parent.BuzzerB.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then 
		Control.Dong.Playing = true 
		wait(1)
		Control.Dong.Playing = false 
	end
end)

script.Parent.BuzzerC.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then 
		Control.Dong.Playing = true 
		wait(1)
		Control.Dong.Playing = false 
	end
end)

script.Parent.BuzzerD.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then 
		Control.Dong.Playing = true 
		wait(1)
		Control.Dong.Playing = false 
	end
end)

script.Parent.CloseA.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then 
		Counter1.SurfaceGui.TextBox.Text = "CLOSED"
	end
end)

script.Parent.CloseB.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then 
		Counter2.SurfaceGui.TextBox.Text = "CLOSED"
	end
end)

script.Parent.CloseC.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then 
		Counter3.SurfaceGui.TextBox.Text = "CLOSED"
	end
end)

script.Parent.CloseD.ClickDetector.MouseClick:connect(function(Player)
	if Player.Team.Name == "Medical Staff" then 
		Counter4.SurfaceGui.TextBox.Text = "CLOSED"
	end
end)```

Please tell me if you are confused.

Please do not name your topic/post something that isn’t related to your question. A lot of users on the forum are busy or want to help with certain things, and it makes everyone’s life easier if you named your topic correctly. Please try to do that next time!

1 Like
textbox = game.ServerStorage.Card.Handle.SurfaceGui.TextBox
local Counter1 = game.ServerStorage.Card

t = 1000

script.Parent.Kiosk1.Dispenser1.ClickDetector.MouseClick:connect(function(player)
	if player.Backpack:FindFirstChild(Counter1.Name) == nil then
		t += 1
		textbox.Text = t
		Counter1.ToolTip = t
		print(t)
		local Clone = Counter1:Clone()
		Clone.Parent = player.Character
		script.Parent.Kiosk1.Dispenser1.Sound.Playing = true
		wait(1)
		script.Parent.Kiosk1.Dispenser1.Sound.Playing = false
		script.Parent.Kiosk1.Dispenser1.ClickDetector.MaxActivationDistance = (“0”)
		wait(1)
		script.Parent.Kiosk1.Dispenser1.ClickDetector.MaxActivationDistance = (“32”)
	end
end)

This is the other script the user is working with.