Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a room with only a max amount of people allowed?

Asked by 3 years ago

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.

2 answers

Log in to vote
0
Answered by 3 years ago

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.

0
i'm not good at scripting could you just give like a sample of that so i can use it in my script LinkDragonBorn 0 — 3y
Ad
Log in to vote
0
Answered by
Simxzn 2
3 years ago
Edited 3 years ago

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

0
I did it not working. I think it's the teleport script i did wrong LinkDragonBorn 0 — 3y
0
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 LinkDragonBorn 0 — 3y
0
9.5, 511.25) end end while wait(3) do tp() end end end end)() LinkDragonBorn 0 — 3y
0
Sorry i don't know how to format it like you did. LinkDragonBorn 0 — 3y

Answer this question