I need some help on a game I'm making. It has different queues so it reserves private servers for groups of people. I know how to do that part but how do I make it so only a certain amount of people can get into the queue. I'm using a teleporter to transport the groups but how do i make it so that once 3 people get in the queue no more people can join.
How do I make a room with only a max amount of people allowed?
2 answers
make a value and every time a person joins the queue it rises by 1. And before the person joins the queue, you check if the value is less than 3.
The script should go something like this:
local queueval = Instance.new("IntValue")
game.Players.PlayerAdded:Connect(function()
queueval.Value = queueval.Value + 1
end)
couroutine.wrap(function()
while wait() do
if queueval.Value == 3 then
--script to teleport here
end
end
end)()
Should work if it doesnt let me know
4 comments
I did it not working. I think it's the teleport script i did wrong
local queueval = Instance.new("IntValue") game.Players.PlayerAdded:Connect(function() queueval.Value = queueval.Value + 1 end couroutine.wrap(function() while wait() do if queueval.Value == 3 then function tp() local players = game.Players:GetPlayers() for i = 1,#players do players[i].Character.HumanoidRootPart.CFrame = game.Workspace.Part.CFrame + Vector3.new(224.5, 1
9.5, 511.25) end end while wait(3) do tp() end end end end)()
Sorry i don't know how to format it like you did.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
i'm not good at scripting could you just give like a sample of that so i can use it in my script