Hi!
So, let's begin with the big chunk.
repeat wait()
CurrentPlayer = Services.Players:GetChildren()[math.random(1,Services.Players.NumPlayers)]
if CurrentPlayer.PlayerData.InGame.Value == true then
CreateBomb(CurrentPlayer)
if #InGame <=1 then
warn('FINISHED')
GameFinished = true
else
CreateBomb(CurrentPlayer)
end
coroutine.resume(coroutine.create(function()
while gamePlaying == true and wait() do -- FROM HERE, IT RUNS EVERY 'ROUND' AS LONG AS THERE ARE 2 OR MORE PLAYERS
wait()
if #InGame >= 2 then
pcall(function()
if FindNearestPlayer(CurrentPlayer) then -- GAME ESSENTIAL, FOR PASSING 'BOMB' TO ANOTHER PLAYER
local NewPlayer = FindNearestPlayer(CurrentPlayer)
if require(Services.ServerScriptService.Modules.IterateTable)(InGame,NewPlayer) and not debounce and NewPlayer.Character.Humanoid.Health > 1 then
debounce = true
wait()
if game:GetService("GamePassService"):PlayerHasPass(CurrentPlayer, GamepassSpeed5) then
CurrentPlayer.Character.Humanoid.WalkSpeed = CurrentPlayer.Character.Humanoid.WalkSpeed - 15
print('Removed 10 speed from ',CurrentPlayer.Name)
else
CurrentPlayer.Character.Humanoid.WalkSpeed = CurrentPlayer.Character.Humanoid.WalkSpeed - 10
print('Removed -5 speed from ',CurrentPlayer.Name)
end
CurrentPlayer.Character.Bomb:Destroy()
wait()
print('Passed Bomb from ',CurrentPlayer.Name,' to player ',NewPlayer,'. ')
CurrentPlayer = NewPlayer
wait()
if #InGame <=1 then
warn('FINISHED')
GameFinished = true
else
CreateBomb(NewPlayer)
end
spawn(function()
wait(1)
debounce = false
end)
end
end
end)
else
warn('Not enough players in-game. SMH')
GameFinished = true
end
end
end))
wait()
ShowTimer:FireAllClients()
MapTime = CurrentMap.Stats.Time.Value
CurrentMapTimer = script.CurrentMapTime
CurrentMapTimer.Value = MapTime
for i = CurrentMapTimer.Value ,0,-1 do -- THIS IS A TIMER THAT COUNTSDOWN, ONCE TO 0, THE BOMB EXPLODES
wait(1)
ChangeTimerText:FireAllClients(i)
CurrentMapTimer.Value = CurrentMapTimer.Value -1
end
warn('Timer ended') -- IN THE LINES BELOW, IT KILLS THE PLAYER... (so much hate. IT DOES NOT!!!!!!!!!. why freaking roblox...)
if CurrentPlayer and CurrentPlayer.Character:FindFirstChild('Bomb') then-- WAS if CurrentPlayer and CurrentPlayer.Character:FindFirstChild('Bomb') then
CurrentPlayer.PlayerData.InGame.Value = false
warn('Player ',CurrentPlayer,' should be killed')
local Explosion = Instance.new('Explosion',CurrentPlayer.Character.Bomb)
Explosion.BlastPressure = 0
Explosion.Position = CurrentPlayer.Character.Bomb.Position
CurrentPlayer.Character.Bomb:Destroy()
CurrentPlayer.Character:BreakJoints()
UpdateXP:Fire(CurrentPlayer,5)
HideTimer:FireClient(CurrentPlayer)
wait()
end
end
wait()
print('InGame = ',#InGame)
if #InGame <=1 then
warn('FINISHED')
GameFinished = true
else
end
until GameFinished == true or #InGame == 1 -- #InGame <= 1 -- AND HERE IT RESTARTS AGAIN, IF THERE ARE ENOUGH PLAYERS. IT GOES BACK TO "while gamePlaying == true and wait() do" AGAIN.
The script runs a fully game round. But, the issue's i have, are a couple. i'll note them down...
1: It does NOT propely detect if there are enough players in-game (#InGame).

1 comment
I cant really put my finger on it, try just putting break points to tell if it is even doing anything.