I have a round system that works very well, until the rounds actually start. The initial timer counts from 10 and when it reaches 0, the problem occurs. The round instantly ends for no apparent reason even when there are at least 2 players. No errors are displayed in output and it’s really frustrating me. I’ve tried using for loops, repeat loops, and while loops to manage the actual round. Nothing works…
Round System code:
local round = require(script.Round)
local configuration = script.Parent.Parent.Others
local intermissionTime = configuration.IntermissionTime.Value
local status = workspace.Stats.Status
local gateA = workspace.Map.Gate.GateA
local gateB = workspace.Map.Gate.GateB
local tweenService = game:GetService("TweenService")
task.wait(5)
while true do
tweenService:Create(gateA, TweenInfo.new(0.5, Enum.EasingStyle.Bounce, Enum.EasingDirection.InOut), {CFrame = gateA.Parent.GateADestination.CFrame}):Play()
tweenService:Create(gateB, TweenInfo.new(0.5, Enum.EasingStyle.Bounce, Enum.EasingDirection.InOut), {CFrame = gateB.Parent.GateBDestination.CFrame}):Play()
for i = intermissionTime, 1, -1 do
status.Value = `Intermission: {i} second{i ~= 1 and "s" or ""} left!`
task.wait(1)
end
tweenService:Create(gateA, TweenInfo.new(0.5, Enum.EasingStyle.Bounce, Enum.EasingDirection.InOut), {CFrame = gateA.Parent.GateAStart.CFrame}):Play()
tweenService:Create(gateB, TweenInfo.new(0.5, Enum.EasingStyle.Bounce, Enum.EasingDirection.InOut), {CFrame = gateB.Parent.GateBStart.CFrame}):Play()
if #round:GetPlaying() < 2 then
status.Value = "Not enough players to start!"
for _, v in round:GetPlaying() do
v:LoadCharacter()
end
task.wait(2)
continue
end
local map = game.ServerStorage.Maps:GetChildren()[math.random(#game.ServerStorage.Maps:GetChildren())]:Clone()
status.Value = `Chosen map: {map.Name}`
map.Parent = workspace
task.wait(3)
if #round:GetPlaying() < 2 then
status.Value = "Not enough players to start!"
for _, v in round:GetPlaying() do
v:LoadCharacter()
end
task.wait(2)
map:Destroy()
continue
end
for _, v in round:GetPlaying() do
v.Character.Parent = workspace.Characters.InGame
end
require(script.Round[map.Name])(map)
local names = {}
for _, v in round:GetInGame() do
table.insert(names, v.Name)
end
status.Value = #names > 0 and `Winner{#names > 1 and "s" or ""}: {table.concat(names, ", ")}` or "No winners!"
for _, v in round:GetInGame() do
v:LoadCharacter()
v.leaderstats.Wins.Value += 1
v.PlayerData.Coins.Value += math.random(100, 200)
end
map:Destroy()
task.wait(3)
end
Example scripts (bug applies to all maps):
- The floor is lava:
local status = workspace.Stats.Status
return function(map)
for i = 10, 1, -1 do
status.Value = `Lava will start rising in {i} second{i == 1 and "" or "s"}!`
task.wait(1)
end
local i = map:GetAttribute("Time")
local debounce = false
map.Lava.Touched:Connect(function(hit)
if debounce then return end
debounce = true
if hit and hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid:TakeDamage(20)
end
debounce = false
end)
game:GetService("TweenService"):Create(map.Lava, TweenInfo.new(i, Enum.EasingStyle.Bounce), {CFrame = CFrame.new(-295.974, -44.584, -193.312)}):Play()
while #workspace.Characters.InGame:GetChildren() > 1 and i > 0 do
status.Value = `The lava will stop rising in {i} second{i == 1 and "" or "s"}!`
i -= 1
task.wait(1)
end
end
- Spleef:
local status = workspace.Stats.Status
return function(map)
for _, v in require(script.Parent):GetInGame() do
v.Character:PivotTo(map.Tiles:GetChildren()[math.random(#map.Tiles:GetChildren())]:GetPivot() * CFrame.new(0, 2.5, 0))
end
map.Lava.Touched:Connect(function(hit)
if hit and hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid.Health = 0
end
end)
for i = 10, 1, -1 do
status.Value = `Tiles will start to disappear under your feet in {i} second{i == 1 and "" or "s"}!`
task.wait(1)
end
for _, v: Part in map.Tiles:GetChildren() do
local active = false
local tween = game:GetService("TweenService"):Create(v, TweenInfo.new(0.75, Enum.EasingStyle.Exponential), {Transparency = 1})
tween.Completed:Connect(function()
task.delay(5, function()
local t = game:GetService("TweenService"):Create(v, TweenInfo.new(0.75, Enum.EasingStyle.Exponential), {Transparency = 0})
t.Completed:Once(function()
v.CanCollide = true
active = false
end)
t:Play()
end)
v.CanCollide = false
end)
v.Touched:Connect(function(hit)
if active then return end
if hit and hit.Parent:FindFirstChild("Humanoid") then
active = true
tween:Play()
end
end)
end
local i = map:GetAttribute("Time")
while #workspace.Characters.InGame:GetChildren() > 1 and i > 0 do
status.Value = `The tiles will stop disappearing in {i} second{i == 1 and "" or "s"}!`
i -= 1
task.wait(1)
end
end