I’ve got a round system script which calls module functions depending on the game mode. There have been very little issues with it’s functionality, except the fact that the disasters only start when I get eliminated, aka, when the collection service tag on the eliminated player changes from:
Alive
to
Dead
I don’t understand why this is happening, and it isn’t meant to function this way anyway. The idea was it would repeatedly run a function until either of the 2 conditionals are met. I would really appreciate support on this!
Game Code (Snippet)
while true do
local isReady = CheckPlayers()
if isReady then
game.ReplicatedStorage.Regenerating.Value = true
local chosenMode = chooseMode()
setMap(chosenMode)
local spleefMap = workspace:WaitForChild("SpleefMap")
print("Enough Players")
game.ReplicatedStorage.Regenerating.Value = false
ReplicatedStorage.IsIntermission.Value = true
for i = 30, 0, -1 do
Intermission.Value = i
wait(1)
end
local configurationTable = {
["Classic"] = function()
TeleportPlayers()
repeat
selectDisasters()
wait(5)
until roundTime.Value == 0 or #CollectionService:GetTagged("Alive") == 0
end,
["Chess Chaos"] = function()
TeleportPlayers()
repeat
disasterModule.Chess()
wait(5)
until roundTime.Value == 0 or #CollectionService:GetTagged("Alive") == 0
end,
["Colour Elimination"] = function()
local randomRGBTable = {
BrickColor.Red(),
BrickColor.Green(),
BrickColor.Blue()
}
TeleportPlayers()
repeat
selectDisasters()
local TextLabel = workspace:FindFirstChild("Current"):FindFirstChild("Part"):FindFirstChild("SurfaceGui"):FindFirstChild("TextLabel")
local rnd = randomRGBTable[math.random(1,#randomRGBTable)]
for i = 1, 15 do
selectDisasters()
if rnd == BrickColor.Red() then
TextLabel.Text = "Getting Rid Of Red"
elseif rnd == BrickColor.Blue() then
TextLabel.Text = "Getting Rid Of Blue"
else
TextLabel.Text = "Getting Rid Of Green"
end
local tile
repeat
tile = spleefMap:GetDescendants()[math.random(1,#spleefMap:GetDescendants())]
wait()
until tile:IsA("Part") and tile.BrickColor == rnd
if tile.BrickColor == rnd then
local explosion = Instance.new("Explosion")
explosion.Parent = tile
explosion.Position = tile.Position + Vector3.new(0,1,0)
wait(1)
explosion:Destroy()
tile:Destroy()
end
wait(1)
end
for i = 10,0, -1 do
TextLabel.Text = "Cooldown ("..i.."). Get Ready"
wait(1)
end
until roundTime.Value == 0 or #CollectionService:GetTagged("Alive") == 0
end,
["Zapper"] = function()
TeleportPlayers()
repeat
disasterModule.Zap()
wait(5)
until roundTime.Value == 0 or #CollectionService:GetTagged("Alive") == 0
end,
}
if Intermission.Value == 0 then
for i, v in pairs(game.Players:GetPlayers()) do
CollectionService:AddTag(v, "Alive")
end
ReplicatedStorage.IsIntermission.Value = false
game.ReplicatedStorage.StartPowerups:FireAllClients(true)
print("Starting")
configurationTable[chosenMode]()
for i = 120, 0, -1 do
if roundTime.Value == 0 or #CollectionService:GetTagged("Alive") == 0 then
break
end
wait(1)
end
end