I’m attempting to make a lobby system, but it’s proven to be a very big hassle for me.
I’ve tried YouTube tutorials (None of them what I’m looking for), DevForum posts (Again, none of them what I’m looking for) and I’ve attempted my own methods, but to no avail.
Essentially, what I’m doing is that I have two teams, a Lobby team (For players sitting in a lobby) and a Playing team for those who are actually in the game playing. I would like an intermission GUI to count down to 0, and then put everyone sitting in the lobby while there are no players in the Playing team to be put into the Playing team.
I’ve attempted to use Values, for loops, and while loops, but nothing has worked for me.
Looking for some help here, would appreciate it if I could even get the slightest nudge.
First attempt at this. (I got the lobby to playing down, but I was not able to get the playing to lobby down.
local Status = game:GetService("ReplicatedStorage").Status
local Started = false
while Started == false do
for i = 10, 0, -1 do
Status.Value = i
task.wait(1)
if Status.Value == "0" then
Status.Value = "Round started!"
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
if Started == false then
v.Team = Teams["Playing"]
v:LoadCharacter()
Started = true
end
end
end
end
end
local PlayingCount = #Teams["Playing"]:GetPlayers()
while Started == true do
for i = 60, 0, -1 do
Status.Value = i
task.wait(1)
if Status.Value == "0" then
Status.Value = "Round ended!"
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
if Started == false then
v.Team = Teams["Lobby"]
v:LoadCharacter()
Started = false
end
end
end
end
end
Second try (Gave up on this one midway through)
local Status = game:GetService("ReplicatedStorage").Status
local Timer = game:GetService("ReplicatedStorage").Timer
Status.Changed:Connect(function(NewValue)
if Status.Value == "Intermission" then
for i = 10, 0, -1 do
Timer.Value = i
task.wait(1)
if Timer.Value == "0" then
Status.Value = "Round Start"
end
end
elseif Status.Value == "Round Start" then
Starting = true
while Starting do
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
v.Team = Teams["Playing"]
v:LoadCharacter()
Status.Value = "Game in Progress"
end
end
elseif Status.Value == "Game in Progress" then
Starting = false
end
end)
for i,v in pairs(game:GetService("Players"):GetPlayers()) do
v.Character.Humanoid.Died:Connect(function()
if v.Team == Teams["Playing"] then
v.Team = Teams["Lobby"]
end
end)
end
Status.Value = "Intermission"