I want to make a matchmaking system with a minimum of 8 players and a maximum of 16 players.
I also want to put a player count under the label that is going to say ex: 7/16 players
A button to leave the platform.
What is the issue?
I’m trying to add minimum players and a maximum, but I don’t know how to do it.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have searched for answers on how to do fix the problem but have found nothing.
local ID = 6502752548
local TIME = 20 -- Time before starting a match
local WAIT_MSG = "Next match starts in"
local TP_MSG = "Teleporting players to match"
local TP_VALUE_DELAY = 5
while true do
wait()
for i = TIME,0,-1 do
script.Parent.Timer.SG.TL.Text = WAIT_MSG .. " " .. i
wait(1)
end
script.Parent.Teleporting.Value = true
local PlrTable = {}
local Characters = script.Parent.Players:GetChildren()
if Characters[1] ~= nil then
for i = 1 , #Characters do
wait(math.random(0.1,2.1))
PlrTable[#PlrTable + 1] = game.Players:GetPlayerFromCharacter(Characters[i])
end
repeat wait() until #PlrTable >= #Characters
local Code = game:GetService("TeleportService"):ReserveServer(ID)
if script.Parent.Vehicle.Value == false then
game:GetService('TeleportService'):TeleportToPrivateServer(ID,Code,PlrTable)
else
for i = 1 , #PlrTable do
local c = PlrTable[i].Character:GetChildren()
for i2 = 1 , #c do
if c[i2].ClassName == "Acessory" then
c[i2]:Destroy()
end
if c[i2].ClassName == "Part" then
c[i2].Transparency = 1
end
end
end
wait(3)
game:GetService('TeleportService'):TeleportToPrivateServer(ID,Code,PlrTable)
end
script.Parent.Timer.SG.TL.Text = TP_MSG
end
wait(TP_VALUE_DELAY)
script.Parent.Teleporting.Value = false
end