How to make a queue system with physical touch on parts

Ok I know the title isn’t really constructive enough, but this is my model I created:
image

Similarly to Doors, I want it to get a limit of 4 players, while if the player is in the queue tween the camera to a part in the model, I also want a timer to be displayed on the BillboardGUI, and teleport all queued players to a reserved server when the timer hits 0, along with a leave button on the GUI (and a loading screen)

I hope you get what I am meaning to say here. Please help, or let me know if my post isnt contructive enough and ill improve it

2 Likes

Have you tried to begin? Or just can’t?

3 Likes

I tried. I just had problems with storing the players in a table, and the actual teleporting part

1 Like

What does your code look like rn?

1 Like

I know how horrible this looks im sorry

local t = 15

while true do
	wait(1)
	if t == 0 then
		t = 15 -- idk what do do after
	else
		t = t - 1
	end
	script.Parent.BillboardGui.Time.Text = "Time: "..t
end
2 Likes

Ok first off you need to get the players. How do you want players to enter the queue? Via touching a part or?

1 Like

I want them to touch a part, then teleport to another part, then be able to teleport to yet another part and exit the queue via clicking a button.

2 Likes

Ok you can do that by doing.

local part = -- path to part
local teleportPart = -- path to teleport part

part.Touched:Connect(function(hit)
	if game.Players:GetPlayerFromCharacter(hit.Parent) then
		hit.Parent.PrimaryPart.CFrame = teleportPart.CFrame
	end
end)
1 Like

I suggest splitting your code off into a couple chunks to get starteded easily.
For this problem here is how i would split it:
• Detecting when a player joins
• Detecting when a player leaves
• Logic behind what happens when a player joins/leaves
• Timer
• on Timer end

As for storing the players just making a table holding the players’ value and then using table.insert/remove/find etc to manipulate the table should be fine

1 Like

by joining and leaving do you mean entering the queue, or joining the game?

1 Like

I meant joining the queue not joining the game.

1 Like

Joining the queue
You can also use region3 or GetPartBoundsInBox to determine queue area and then do a check every half a second or second.

If you want to end a timer if there are 0 players in the queue you would probably also need to use runservice for your timer imo

1 Like

i would like to use tables instead since its more convinient for me.

1 Like

So I made everything work and all. I just need to allow the player to leave the queue, and to teleport players in the queue when the timer hits 0. The only way the player can leave queue is by resetting their character.
This is how it looks right now

(should I use player IDs instead of usernames, and how?

1 Like

After setting the cframe, you can connect once to the button with button.Activated:Once(). Then you can teleport the player to the part outside of the area.

1 Like

Then, about the teleportation, in the if statement where you check if the timer hits 0 you can use TeleportService:TeleportPartyAsync(), API here: TeleportService | Documentation - Roblox Creator Hub

1 Like

Thanks. One more thing: How can I make the Camera Tween to a part when the player is in queue?

1 Like

Set camera.CameraType = Enum.CameraType.Scriptable then use TweenService normally like so:

local tween = TweenService:Create(camera, TweenInfo.new(0.5), {CFrame = cameraPart.CFrame}
tween:Play()
2 Likes

Where should I put the script? And how should I use it? I already know how to tween parts

1 Like

Put it where you check if the thing that hit the part is a player.

1 Like