If two players enter at any time, it only adds one person to the queue and only adds the other when the person added leaves! This is just a chunk of a script that teleports everyone that touches a specific part to a private server.
local QueuePart = workspace.queue.QueuePart
local Players = game:GetService("Players")
local pgroup = {}
function AddToQueue(hit)
if hit.Name == "HumanoidRootPart" and not teleporting then
hit.Parent.Humanoid.WalkSpeed = 10
UpdatePlyCount(1)
local player = Players:GetPlayerFromCharacter(hit.Parent)
UpdateList(player, true)
print("Adding "..player.Name.." to the queue...")
table.insert(pgroup, #pgroup+1, player)
print("People in queue:"..#pgroup)
end
end
function RemoveFromQueue(hit)
if hit.Name == "HumanoidRootPart" then
hit.Parent.Humanoid.WalkSpeed = 16
local player = Players:GetPlayerFromCharacter(hit.Parent)
UpdateList(player, false)
UpdatePlyCount(-1)
print("Removing "..player.Name.." from the queue...")
table.remove(pgroup, table.find(pgroup, player))
print("People in queue:"..#pgroup)
end
end
QueuePart.Touched:Connect(AddToQueue)
QueuePart.TouchEnded:Connect(RemoveFromQueue)

1 comment
i could upload the full script if you guys want