The player who succesfully helps me out, get's 1,000 Robux. No joke.
Hi!
So, i've made a mini-game. Everything is working fine, with 2 players... However, when a 3rd player joins. It breaks?
Let's begin with the script itself
repeat wait()
CurrentPlayer = Services.Players:GetChildren()[math.random(1,Services.Players.NumPlayers)]
if CurrentPlayer.PlayerData.InGame.Value == true then
CreateBomb(CurrentPlayer)
coroutine.resume(coroutine.create(function()
while gamePlaying == true and wait() do
wait()
pcall(function()
if FindNearestPlayer(CurrentPlayer) then
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
RemoveBomb(CurrentPlayer)
wait()
CurrentPlayer = NewPlayer
CreateBomb(NewPlayer)
spawn(function()
wait(2)
debounce = false
end)
end
end
end)
end -- Einde while gamePlaying == true and wait() do
end))
wait()
ShowTimer:FireAllClients()
MapTime = CurrentMap.Stats.Time.Value
CurrentMapTimer = script.CurrentMapTime
CurrentMapTimer.Value = MapTime
for i = CurrentMapTimer.Value ,0,-1 do
ChangeTimerText:FireAllClients(i)
CurrentMapTimer.Value = CurrentMapTimer.Value -1
wait(1)
end
if CurrentPlayer and CurrentPlayer.Character:FindFirstChild('Bomb') then
local Explosion = Instance.new('Explosion',CurrentPlayer.Character.Bomb)
Explosion.BlastPressure = 0
Explosion.Position = CurrentPlayer.Character.Bomb.Position
CurrentPlayer.Character:BreakJoints()
UpdateXP:Fire(CurrentPlayer,5)
HideTimer:FireClient(CurrentPlayer)
CurrentPlayer.Character:BreakJoints()
wait()
end
wait()
end
until #InGame <= 1
CHECK THIS VIDEO FOR REFERENCE: VIDEO
On line 1: It runs the 'Match' (A match goes on until last man standing. See 'until #InGame <= 1'
On line 5, it passes the 'Bomb' to a player which is nearest. This happens by a function in the same script. This all works fine.
The trouble all begins at line 44
Once players die, their Joints break, to let them die. This sets that there's 1 player less InGame.
But, check this footage. Speak for yourself.
In the footage you'll see:
3 players join the game. All 3 teleport to the game. Then, Player3 gets the bomb, passes it to P1, and then takes it back again (all normal). But, once the timer ends. the Bomb explodes, this should BreakJoints() the CURRENTPLAYER who holds the bomb. This succesfully happens to Player1, because he's holder the bomb.
Now he died, 2 players remain in-game. A new bomb will be randomly picked on player 2 & 3, it's being spawned on player2.
Now the timer goes off again, AND NOW STUFF'S GOING ON BRUH Player2 does NOT DIE. But instead, a new bomb is cloned to P3, and the Bomb from P2 is not removed...? There do not appear any errorcodes...
So, the timer goes on again, both players carrying a bomb... Lol? So, timer has ended. The bomb explodes. WHO DIES? PLAYER2! While both we're carrying, which isn't supposed to happen.
I don't know why this happens. But it would be nice if someone could help me out. I'll paste the full script in a PasteBin.

3 comments
Can you please put in the output error?
There are 0 errors...
can you show a pitcture of the hierachy and are you sure the pastebin is the completescript ? like MinimumPlayers is never defined in the pastebin