- What do you want to achieve? Keep it simple and clear!
My game is a pass the bomb/bomb tag game with customizable bombs and explosions. However, it takes so long for the game to start and a person to be given the bomb.
- What is the issue? Include screenshots / videos if possible!
It takes so long for the game to give a person a bomb and I don’t know why.
Here is the script:
local players
local bomber = nil
local bomber2 = nil
local bomber3 = nil
local playereffect
local playereffect2
local playereffect3
local maps = game.ReplicatedStorage.Maps:GetChildren()
local votingSystem = game.Workspace.Voting
local firstPlace = nil
local secondPlace = nil
local thirdPlace = nil
local times = 0
local db = false
local db2 = false
local db3 = false
local choices = votingSystem:GetChildren()
local function PickRandomMap()
local randomNumber = math.random(1, #maps)
randomMap = maps[randomNumber]
return randomMap
end
while wait() do
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients("Waiting For 3 Players...")
workspace.InGame.Value = true
repeat wait()
players = game.Teams.In:GetPlayers()
until #players >= 3
if workspace:FindFirstChild("Crossroads") then
workspace.Crossroads:Destroy()
end
if workspace:FindFirstChild("Rocket Arena") then
workspace["Rocket Arena"]:Destroy()
end
if workspace:FindFirstChild("Techno Pad") then
workspace["Techno Pad"]:Destroy()
end
if workspace:FindFirstChild("The Carnival") then
workspace["The Carnival"]:Destroy()
end
if workspace:FindFirstChild("The Prison") then
workspace["The Prison"]:Destroy()
end
if workspace:FindFirstChild("The Forest") then
workspace["The Forest"]:Destroy()
end
if workspace:FindFirstChild("The Mansion") then
workspace["The Mansion"]:Destroy()
end
--if times == 3 then
-- script.Parent["Special Main"].Enabled = true
--script.Enabled = false
-- end
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients("Starting Soon...")
wait(30)
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients("Vote For The Next Map!")
workspace.VotingTime.Value = true
for i, choice in pairs(choices) do
if i == 1 then
local name = choice.Sign.Paper.SurfaceGui.TextLabel
local picture = choice.Sign.Paper.SurfaceGui.ImageLabel
map1 = PickRandomMap()
name.Text = randomMap.Name
picture.Image = "rbxassetid://" .. randomMap.Image.Value
randomMap.CanBeVoted.Value = true
elseif i == 2 then
local name = choice.Sign.Paper.SurfaceGui.TextLabel
local picture = choice.Sign.Paper.SurfaceGui.ImageLabel
repeat wait()
map2 = PickRandomMap()
until map2 ~= map1
name.Text = randomMap.Name
picture.Image = "rbxassetid://" .. randomMap.Image.Value
randomMap.CanBeVoted.Value = true
elseif i == 3 then
local name = choice.Sign.Paper.SurfaceGui.TextLabel
local picture = choice.Sign.Paper.SurfaceGui.ImageLabel
repeat wait()
map3 = PickRandomMap()
until map3 ~= map2 and map3 ~= map1
name.Text = randomMap.Name
picture.Image = "rbxassetid://" .. randomMap.Image.Value
randomMap.CanBeVoted.Value = true
end
end
wait(30)
local Choice1Votes = votingSystem["Choice 1"].VotesAmount.Value
local Choice2Votes = votingSystem["Choice 2"].VotesAmount.Value
local Choice3Votes = votingSystem["Choice 3"].VotesAmount.Value
if Choice1Votes >= Choice2Votes and Choice1Votes >= Choice3Votes then
Map = game.ReplicatedStorage.Maps:FindFirstChild(votingSystem["Choice 1"].Sign.Paper.SurfaceGui.TextLabel.Text):Clone()
if votingSystem["Choice 1"].Sign.Paper.SurfaceGui.TextLabel.Text == "The Carnival" then
workspace.BGMusic.SoundId = "rbxassetid://1841682272"
end
if votingSystem["Choice 1"].Sign.Paper.SurfaceGui.TextLabel.Text == "Techno Pad" then
workspace.BGMusic.SoundId = "rbxassetid://1842976958"
end
if votingSystem["Choice 1"].Sign.Paper.SurfaceGui.TextLabel.Text == "Rocket Arena" then
workspace.BGMusic.SoundId = "rbxassetid://1847042482"
end
if votingSystem["Choice 1"].Sign.Paper.SurfaceGui.TextLabel.Text == "Crossroads" then
workspace.BGMusic.SoundId = "rbxassetid://1845535642"
end
if votingSystem["Choice 1"].Sign.Paper.SurfaceGui.TextLabel.Text == "The Forest" then
workspace.BGMusic.SoundId = "rbxassetid://1845205138"
end
if votingSystem["Choice 1"].Sign.Paper.SurfaceGui.TextLabel.Text == "The Mansion" then
workspace.BGMusic.SoundId = "rbxassetid://1837768517"
end
elseif Choice2Votes >= Choice1Votes and Choice2Votes >= Choice3Votes then
Map = game.ReplicatedStorage.Maps:FindFirstChild(votingSystem["Choice 2"].Sign.Paper.SurfaceGui.TextLabel.Text):Clone()
if votingSystem["Choice 2"].Sign.Paper.SurfaceGui.TextLabel.Text == "The Carnival" then
workspace.BGMusic.SoundId = "rbxassetid://1841682272"
end
if votingSystem["Choice 2"].Sign.Paper.SurfaceGui.TextLabel.Text == "Techno Pad" then
workspace.BGMusic.SoundId = "rbxassetid://1842976958"
end
if votingSystem["Choice 2"].Sign.Paper.SurfaceGui.TextLabel.Text == "Rocket Arena" then
workspace.BGMusic.SoundId = "rbxassetid://1847042482"
end
if votingSystem["Choice 2"].Sign.Paper.SurfaceGui.TextLabel.Text == "Crossroads" then
workspace.BGMusic.SoundId = "rbxassetid://1845535642"
end
if votingSystem["Choice 2"].Sign.Paper.SurfaceGui.TextLabel.Text == "The Forest" then
workspace.BGMusic.SoundId = "rbxassetid://1845205138"
end
if votingSystem["Choice 2"].Sign.Paper.SurfaceGui.TextLabel.Text == "The Mansion" then
workspace.BGMusic.SoundId = "rbxassetid://1837768517"
end
else
Map = game.ReplicatedStorage.Maps:FindFirstChild(votingSystem["Choice 3"].Sign.Paper.SurfaceGui.TextLabel.Text):Clone()
if votingSystem["Choice 3"].Sign.Paper.SurfaceGui.TextLabel.Text == "The Carnival" then
workspace.BGMusic.SoundId = "rbxassetid://1841682272"
end
if votingSystem["Choice 3"].Sign.Paper.SurfaceGui.TextLabel.Text == "Techno Pad" then
workspace.BGMusic.SoundId = "rbxassetid://1842976958"
end
if votingSystem["Choice 3"].Sign.Paper.SurfaceGui.TextLabel.Text == "Rocket Arena" then
workspace.BGMusic.SoundId = "rbxassetid://1847042482"
end
if votingSystem["Choice 3"].Sign.Paper.SurfaceGui.TextLabel.Text == "Crossroads" then
workspace.BGMusic.SoundId = "rbxassetid://1845535642"
end
if votingSystem["Choice 3"].Sign.Paper.SurfaceGui.TextLabel.Text == "The Forest" then
workspace.BGMusic.SoundId = "rbxassetid://1845205138"
end
if votingSystem["Choice 3"].Sign.Paper.SurfaceGui.TextLabel.Text == "The Mansion" then
workspace.BGMusic.SoundId = "rbxassetid://1837768517"
end
end
workspace.VotingTime.Value = false
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients("Map Chosen - "..Map.Name)
workspace.InGame.Value = false
Map.Parent = workspace
workspace.Voting["Choice 1"].button.Color = Color3.fromRGB(30, 111, 165)
workspace.Voting["Choice 2"].button.Color = Color3.fromRGB(30, 111, 165)
workspace.Voting["Choice 3"].button.Color = Color3.fromRGB(30, 111, 165)
workspace.Voting["Choice 1"].VotesAmount.Value = 0
workspace.Voting["Choice 1"].Sign.Paper.SurfaceGui.TextLabel.Text = "None"
workspace.Voting["Choice 1"].Sign.Paper.SurfaceGui.ImageLabel.Image = ""
workspace.Voting["Choice 1"].Votes.BillboardGui.TextLabel.Text = "0 Votes"
workspace.Voting["Choice 2"].VotesAmount.Value = 0
workspace.Voting["Choice 2"].Sign.Paper.SurfaceGui.TextLabel.Text = "None"
workspace.Voting["Choice 2"].Sign.Paper.SurfaceGui.ImageLabel.Image = ""
workspace.Voting["Choice 2"].Votes.BillboardGui.TextLabel.Text = "0 Votes"
workspace.Voting["Choice 3"].VotesAmount.Value = 0
workspace.Voting["Choice 3"].Sign.Paper.SurfaceGui.TextLabel.Text = "None"
workspace.Voting["Choice 3"].Sign.Paper.SurfaceGui.ImageLabel.Image = ""
workspace.Voting["Choice 3"].Votes.BillboardGui.TextLabel.Text = "0 Votes"
game.ReplicatedStorage.RemoteEvents.ResetVotes:FireAllClients()
if Map.Name == "The Forest" then
game.ReplicatedStorage.RemoteEvents.CutsceneEvent:FireAllClients("The Forest")
workspace.BGMusic.TimePosition = 0
workspace.BGMusic.SoundId = "rbxassetid://1845538750"
wait(7)
workspace.BGMusic.SoundId = "rbxassetid://1845205138"
end
if Map.Name == "Rocket Arena" then
game.ReplicatedStorage.RemoteEvents.CutsceneEvent:FireAllClients("Rocket Arena")
workspace.BGMusic.TimePosition = 0
workspace.BGMusic.SoundId = "rbxassetid://1845092181"
wait(5)
workspace.BGMusic.SoundId = "rbxassetid://1847042482"
end
if Map.Name == "Crossroads" then
game.ReplicatedStorage.RemoteEvents.CutsceneEvent:FireAllClients("Crossroads")
workspace.BGMusic.TimePosition = 0
workspace.BGMusic.SoundId = "rbxassetid://1838782206"
wait(10)
workspace.BGMusic.SoundId = "rbxassetid://1845535642"
end
if Map.Name == "Techno Pad" then
game.ReplicatedStorage.RemoteEvents.CutsceneEvent:FireAllClients("Techno Pad")
workspace.BGMusic.TimePosition = 0
workspace.BGMusic.SoundId = "rbxassetid://9043681154"
wait(10)
workspace.BGMusic.SoundId = "rbxassetid://1842976958"
end
if Map.Name == "The Carnival" then
game.ReplicatedStorage.RemoteEvents.CutsceneEvent:FireAllClients("The Carnival")
workspace.BGMusic.TimePosition = 0
workspace.BGMusic.SoundId = "rbxassetid://1845069952"
wait(10)
workspace.BGMusic.SoundId = "rbxassetid://1841682272"
end
if Map.Name == "The Mansion" then
game.ReplicatedStorage.RemoteEvents.CutsceneEvent:FireAllClients("The Mansion")
workspace.BGMusic.TimePosition = 0
workspace.BGMusic.SoundId = "rbxassetid://1838727070"
wait(7)
workspace.BGMusic.SoundId = "rbxassetid://1837768517"
end
workspace.BGMusic.TimePosition = 0
for num, player in pairs(game.Teams.In:GetPlayers()) do
local char = player.Character
local val = math.random(1,18)
game.ReplicatedStorage.RemoteEvents.CamType:FireClient(player, "Custom")
game.ReplicatedStorage.RemoteEvents.StartGame:FireClient(player)
for i, v in pairs(Map.Spawns:GetChildren()) do
if i == val then
char.Humanoid.Sit = false
char.HumanoidRootPart.CFrame = v.CFrame
end
end
end
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients("Choosing Gamemode...")
wait(4)
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients("Gamemode Chosen - Bomb Tag")
wait(3)
while wait() do
if #game.Teams.In:GetPlayers() == 0 then
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients("The Remaining Player Has Left...")
wait(3)
break
end
if #game.Teams.In:GetPlayers() == 1 then
for i, v in pairs(game.Teams.In:GetPlayers()) do
firstPlace = v
Map:Destroy()
if thirdPlace ~= nil then
local description = game:GetService("Players"):GetHumanoidDescriptionFromUserId(thirdPlace.UserId)
if description then
workspace["Third Place"].Humanoid:ApplyDescriptionReset(description)
local nametag = game.ReplicatedStorage.HeadTag:Clone()
nametag.Parent = workspace["Third Place"].Head
nametag.User.Text = thirdPlace.Name
nametag.Rank.Text = thirdPlace.leaderstats.Wins.Value.." Wins"
end
end
if secondPlace ~= nil then
local description = game:GetService("Players"):GetHumanoidDescriptionFromUserId(secondPlace.UserId)
if description then
workspace["Second Place"].Humanoid:ApplyDescriptionReset(description)
local nametag = game.ReplicatedStorage.HeadTag:Clone()
nametag.Parent = workspace["Second Place"].Head
nametag.User.Text = secondPlace.Name
nametag.Rank.Text = secondPlace.leaderstats.Wins.Value.." Wins"
end
end
if firstPlace ~= nil then
for i, v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild("Win Streak") then
v:FindFirstChild("Win Streak").Value = 0
end
end
local description = game:GetService("Players"):GetHumanoidDescriptionFromUserId(firstPlace.UserId)
if description then
workspace["First Place"].Humanoid:ApplyDescriptionReset(description)
local nametag = game.ReplicatedStorage.HeadTag:Clone()
nametag.Parent = workspace["First Place"].Head
nametag.User.Text = firstPlace.Name
nametag.Rank.Text = (firstPlace.leaderstats.Wins.Value + 1).." Wins"
end
end
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(v.Name.." Won The Game!")
workspace.BGMusic.SoundId = "rbxassetid://1844442520"
workspace.BGMusic.TimePosition = 0
game.ReplicatedStorage.RemoteEvents.CutsceneEvent:FireAllClients("Winner")
workspace.BGMusic.PlaybackSpeed = 1
db = false
db2 = false
db3 = false
if v:FindFirstChild("Win Streak") then
if v["Win Streak"].Value >= 1 then
if game:GetService('MarketplaceService'):UserOwnsGamePassAsync(v.UserId, 192619237) then
v.Gold.Value = v.Gold.Value + ((250 * 2) * v["Win Streak"].Value)
game.ReplicatedStorage.RemoteEvents.Notification:FireClient(v, ((250 * 2) * v["Win Streak"].Value).." Bomb Coins Have Been Added to Your Balance", Color3.fromRGB(255, 223, 42), Color3.fromRGB(255, 173, 57))
else
v.Gold.Value = v.Gold.Value + (250 * v["Win Streak"].Value)
game.ReplicatedStorage.RemoteEvents.Notification:FireClient(v, (250 * v["Win Streak"].Value).." Bomb Coins Have Been Added to Your Balance", Color3.fromRGB(255, 223, 42), Color3.fromRGB(255, 173, 57))
end
else
if game:GetService('MarketplaceService'):UserOwnsGamePassAsync(v.UserId, 192619237) then
v.Gold.Value = v.Gold.Value + 500
game.ReplicatedStorage.RemoteEvents.Notification:FireClient(v, "500 Bomb Coins Have Been Added to Your Balance", Color3.fromRGB(255, 223, 42), Color3.fromRGB(255, 173, 57))
else
v.Gold.Value = v.Gold.Value + 250
game.ReplicatedStorage.RemoteEvents.Notification:FireClient(v, "250 Bomb Coins Have Been Added to Your Balance", Color3.fromRGB(255, 223, 42), Color3.fromRGB(255, 173, 57))
end
end
end
if times == 3 then
times = 0
else
times = times + 1
end
v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
if v:FindFirstChild("Win Streak") then
v["Win Streak"].Value = v["Win Streak"].Value + 1
end
wait(8)
workspace.BGMusic.SoundId = "rbxassetid://1835322551"
v.Team = game.Teams.Out
v.Character.Humanoid.Health = 0
wait(2)
for i, v in pairs(game.Players:GetPlayers()) do
v.Team = game.Teams.In
end
firstPlace = nil
secondPlace = nil
thirdPlace = nil
end
break
end
print('IN LOOP!')
local value = math.random(1, #game.Teams.In:GetPlayers())
local value2
local value3
if #game.Teams.In:GetPlayers() >= 10 and #game.Teams.In:GetPlayers() < 20 then
repeat wait() print("REPEATING") value2 = math.random(1, #game.Teams.In:GetPlayers()) until value2 ~= value
elseif #game.Teams.In:GetPlayers() >= 20 then
repeat wait() print("REPEATING") value2 = math.random(1, #game.Teams.In:GetPlayers()) until value2 ~= value
repeat wait() print("REPEATING") value3 = math.random(1, #game.Teams.In:GetPlayers()) until value3 ~= value2
end
print("IN LOOP 2!")
for i, v in pairs(game.Teams.In:GetPlayers()) do
local char = v.Character
if value == i then
print("IN LOOP 3")
if #game.Teams.In:GetPlayers() >= 10 and #game.Teams.In:GetPlayers() < 20 then
for i, v2 in pairs(game.Teams.In:GetPlayers()) do
if value2 == i then
if v.Team ~= game.Teams.In then
return
end
if v2.Team ~= game.Teams.In then
return
end
bomber = v.Character
playereffect = v
bomber2 = v2.Character
playereffect2 = v2
print("CHOSE")
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(bomber.Name.." & "..bomber2.Name.." Have The Bomb!")
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Skin" then
bomb = game.ReplicatedStorage.Skins:FindFirstChild(v.Name):Clone()
bomb.Parent = workspace
end
end
end
for i, v in pairs(playereffect2.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Skin" then
bomb2 = game.ReplicatedStorage.Skins:FindFirstChild(v.Name):Clone()
bomb2.Parent = workspace
end
end
end
--bomb.Position = v.Character.Torso.Position + Vector3.new(0, -7, 0)
local weld = Instance.new("Weld")
weld.Name = "BombWeld"
weld.Part0 = bomber.Torso
weld.Part1 = bomb
weld.C0 = CFrame.new(0,0.3,-2)
weld.C1 *= CFrame.Angles(math.pi/2,0,0)
--weld.C0 = CFrame.new(v.Character.Torso.Position, bomb.Position)
weld.Parent = bomb
local weld2 = Instance.new("Weld")
weld2.Name = "BombWeld"
weld2.Part0 = bomber2.Torso
weld2.Part1 = bomb2
weld2.C0 = CFrame.new(0,0.3,-2)
weld2.C1 *= CFrame.Angles(math.pi/2,0,0)
--weld.C0 = CFrame.new(v.Character.Torso.Position, bomb.Position)
weld2.Parent = bomb2
local animation = Instance.new("Animation") -- Create Animation object
animation.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
local animationTrack = bomber.Humanoid:LoadAnimation(animation) -- Load the animation
animationTrack:Play() -- Play the animation
local animation2 = Instance.new("Animation") -- Create Animation object
animation2.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
local animationTrack2 = bomber2.Humanoid:LoadAnimation(animation2) -- Load the animation
animationTrack2:Play() -- Play the animation
bomb.Touched:Connect(function(hit)
if db == false and bomb.Transparency == 0 then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent ~= bomber and hit.Parent ~= bomber2 then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.Team == game.Teams.In then
animationTrack:Stop()
animation:Destroy()
db = true
bomber = hit.Parent
weld.Part0 = bomber.Torso
animation = Instance.new("Animation") -- Create Animation object
animation.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
animationTrack = bomber.Humanoid:LoadAnimation(animation) -- Load the animation
animationTrack:Play()
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(bomber.Name.." & "..bomber2.Name.." Have The Bomb!")
wait(0.5)
db = false
end
end
end
end
end
end)
bomb2.Touched:Connect(function(hit)
if db2 == false and bomb2.Transparency == 0 then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent ~= bomber and hit.Parent ~= bomber2 then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.Team == game.Teams.In then
animationTrack2:Stop()
animation2:Destroy()
db2 = true
bomber2 = hit.Parent
weld2.Part0 = bomber2.Torso
animation2 = Instance.new("Animation") -- Create Animation object
animation2.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
animationTrack2 = bomber2.Humanoid:LoadAnimation(animation2) -- Load the animation
animationTrack2:Play()
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(bomber.Name.." & "..bomber2.Name.." Have The Bomb!")
wait(0.5)
db2 = false
end
end
end
end
end
end)
local val = 1
local val2 = math.random(-1.3,-0.9)
while wait(val) do
if bomb:FindFirstChild("Sound") then
bomb:WaitForChild("Sound"):Play()
end
if bomb:FindFirstChild("PointLight") then
bomb:WaitForChild("PointLight").Enabled = true
end
if bomb:FindFirstChild("Highlight") then
bomb:WaitForChild("Highlight").Enabled = true
end
if bomb2:FindFirstChild("Sound") then
bomb2:WaitForChild("Sound"):Play()
end
if bomb2:FindFirstChild("PointLight") then
bomb2:WaitForChild("PointLight").Enabled = true
end
if bomb2:FindFirstChild("Highlight") then
bomb2:WaitForChild("Highlight").Enabled = true
end
wait(val)
if not bomber then
return
end
if not bomber2 then
return
end
val = val - 0.05
if bomb:FindFirstChild("PointLight") then
bomb:WaitForChild("PointLight").Enabled = false
end
if bomb:FindFirstChild("Highlight") then
bomb:WaitForChild("Highlight").Enabled = false
end
if bomb2:FindFirstChild("PointLight") then
bomb2:WaitForChild("PointLight").Enabled = false
end
if bomb2:FindFirstChild("Highlight") then
bomb2:WaitForChild("Highlight").Enabled = false
end
if val < val2 then
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Explosion" then
effect = bomb:FindFirstChild(v.Name)
if effect == nil then
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name == "Default" then
effect = v
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name ~= "Default" then
v:SetAttribute("Equipped", false)
end
end
end
end
end
end
end
end
end
end
for i, v in pairs(playereffect2.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Explosion" then
effect2 = bomb2:FindFirstChild(v.Name)
if effect2 == nil then
for i, v in pairs(playereffect2.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name == "Default" then
effect2 = v
for i, v in pairs(playereffect2.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name ~= "Default" then
v:SetAttribute("Equipped", false)
end
end
end
end
end
end
end
end
end
end
if effect then
for i, v in pairs(effect:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
local sound = workspace:FindFirstChild(effect.Name)
if sound:IsA("Sound") then
sound:Play()
end
end
if effect2 then
for i, v in pairs(effect2:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
local sound2 = workspace:FindFirstChild(effect2.Name)
if sound2:IsA("Sound") then
sound2:Play()
end
end
if bomber then
bomber.Humanoid:TakeDamage(bomber.Humanoid.Health)
end
if bomber2 then
bomber2.Humanoid:TakeDamage(bomber2.Humanoid.Health)
end
if bomb then
bomb.Transparency = 1
for i, v in pairs(game.Teams.In:GetPlayers()) do
game.ReplicatedStorage.RemoteEvents.ExplosionRE:FireClient(v, (bomb.Position - v.Character.HumanoidRootPart.Position).Magnitude)
end
wait(3)
bomb:Destroy()
end
if bomb2 then
bomb2.Transparency = 1
for i, v in pairs(game.Teams.In:GetPlayers()) do
game.ReplicatedStorage.RemoteEvents.ExplosionRE:FireClient(v, (bomb2.Position - v.Character.HumanoidRootPart.Position).Magnitude)
end
wait(3)
bomb2:Destroy()
end
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients("The Bombs Have Exploded!")
local playerbomber = game.Players:GetPlayerFromCharacter(bomber)
if playerbomber then
if playerbomber then
playerbomber.Team = game.Teams.Out
end
end
local playerbomber2 = game.Players:GetPlayerFromCharacter(bomber2)
if playerbomber2 then
playerbomber2.Team = game.Teams.Out
end
wait(1)
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(#game.Teams.In:GetPlayers().." Players Remain")
break
end
end
end
end
elseif #game.Teams.In:GetPlayers() >= 20 then
for i2, v2 in pairs(game.Teams.In:GetPlayers()) do
if value2 == i2 then
for i3, v3 in pairs(game.Teams.In:GetPlayers()) do
if value3 == i3 then
if v.Team ~= game.Teams.In then
return
end
if v2.Team ~= game.Teams.In then
return
end
if v3.Team ~= game.Teams.In then
return
end
bomber = v.Character
playereffect = v
bomber2 = v2.Character
playereffect2 = v2
bomber3 = v3.Character
playereffect3 = v3
print("CHOSE")
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(bomber.Name.." & "..bomber2.Name.." & "..bomber3.Name.." Have The Bomb!")
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Skin" then
bomb = game.ReplicatedStorage.Skins:FindFirstChild(v.Name):Clone()
bomb.Parent = workspace
end
end
end
for i, v in pairs(playereffect2.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Skin" then
bomb2 = game.ReplicatedStorage.Skins:FindFirstChild(v.Name):Clone()
bomb2.Parent = workspace
end
end
end
for i, v in pairs(playereffect3.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Skin" then
bomb3 = game.ReplicatedStorage.Skins:FindFirstChild(v.Name):Clone()
bomb3.Parent = workspace
end
end
end
--bomb.Position = v.Character.Torso.Position + Vector3.new(0, -7, 0)
local weld = Instance.new("Weld")
weld.Name = "BombWeld"
weld.Part0 = bomber.Torso
weld.Part1 = bomb
weld.C0 = CFrame.new(0,0.3,-2)
weld.C1 *= CFrame.Angles(math.pi/2,0,0)
--weld.C0 = CFrame.new(v.Character.Torso.Position, bomb.Position)
weld.Parent = bomb
local weld2 = Instance.new("Weld")
weld2.Name = "BombWeld"
weld2.Part0 = bomber2.Torso
weld2.Part1 = bomb2
weld2.C0 = CFrame.new(0,0.3,-2)
weld2.C1 *= CFrame.Angles(math.pi/2,0,0)
--weld.C0 = CFrame.new(v.Character.Torso.Position, bomb.Position)
weld2.Parent = bomb2
local weld3 = Instance.new("Weld")
weld3.Name = "BombWeld"
weld3.Part0 = bomber3.Torso
weld3.Part1 = bomb3
weld3.C0 = CFrame.new(0,0.3,-2)
weld3.C1 *= CFrame.Angles(math.pi/2,0,0)
--weld.C0 = CFrame.new(v.Character.Torso.Position, bomb.Position)
weld3.Parent = bomb3
local animation = Instance.new("Animation") -- Create Animation object
animation.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
local animationTrack = bomber.Humanoid:LoadAnimation(animation) -- Load the animation
animationTrack:Play() -- Play the animation
local animation2 = Instance.new("Animation") -- Create Animation object
animation2.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
local animationTrack2 = bomber2.Humanoid:LoadAnimation(animation2) -- Load the animation
animationTrack2:Play() -- Play the animation
local animation3 = Instance.new("Animation") -- Create Animation object
animation3.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
local animationTrack3 = bomber3.Humanoid:LoadAnimation(animation3) -- Load the animation
animationTrack3:Play() -- Play the animation
bomb.Touched:Connect(function(hit)
if db == false and bomb.Transparency == 0 then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent ~= bomber and hit.Parent ~= bomber2 and hit.Parent ~= bomber3 then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.Team == game.Teams.In then
animationTrack:Stop()
animation:Destroy()
db = true
bomber = hit.Parent
weld.Part0 = bomber.Torso
animation = Instance.new("Animation") -- Create Animation object
animation.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
animationTrack = bomber.Humanoid:LoadAnimation(animation) -- Load the animation
animationTrack:Play()
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(bomber.Name.." & "..bomber2.Name.." & "..bomber3.Name.." Have The Bomb!")
wait(0.5)
db = false
end
end
end
end
end
end)
bomb2.Touched:Connect(function(hit)
if db2 == false and bomb2.Transparency == 0 then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent ~= bomber and hit.Parent ~= bomber2 and hit.Parent ~= bomber3 then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.Team == game.Teams.In then
animationTrack2:Stop()
animation2:Destroy()
db2 = true
bomber2 = hit.Parent
weld2.Part0 = bomber2.Torso
animation2 = Instance.new("Animation") -- Create Animation object
animation2.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
animationTrack2 = bomber2.Humanoid:LoadAnimation(animation2) -- Load the animation
animationTrack2:Play()
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(bomber.Name.." & "..bomber2.Name.." & "..bomber3.Name.." Have The Bomb!")
wait(0.5)
db2 = false
end
end
end
end
end
end)
bomb3.Touched:Connect(function(hit)
if db3 == false and bomb3.Transparency == 0 then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent ~= bomber and hit.Parent ~= bomber2 and hit.Parent ~= bomber3 then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.Team == game.Teams.In then
animationTrack3:Stop()
animation3:Destroy()
db3 = true
bomber3 = hit.Parent
weld3.Part0 = bomber3.Torso
animation3 = Instance.new("Animation") -- Create Animation object
animation3.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
animationTrack3 = bomber3.Humanoid:LoadAnimation(animation3) -- Load the animation
animationTrack3:Play()
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(bomber.Name.." & "..bomber2.Name.." & "..bomber3.Name.." Have The Bomb!")
wait(0.5)
db3 = false
end
end
end
end
end
end)
local val = 1
local val2 = math.random(-1.3,-0.9)
while wait(val) do
if bomb:FindFirstChild("Sound") then
bomb:WaitForChild("Sound"):Play()
end
if bomb:FindFirstChild("PointLight") then
bomb:WaitForChild("PointLight").Enabled = true
end
if bomb:FindFirstChild("Highlight") then
bomb:WaitForChild("Highlight").Enabled = true
end
if bomb2:FindFirstChild("Sound") then
bomb2:WaitForChild("Sound"):Play()
end
if bomb2:FindFirstChild("PointLight") then
bomb2:WaitForChild("PointLight").Enabled = true
end
if bomb2:FindFirstChild("Highlight") then
bomb2:WaitForChild("Highlight").Enabled = true
end
if bomb3:FindFirstChild("Sound") then
bomb3:WaitForChild("Sound"):Play()
end
if bomb3:FindFirstChild("PointLight") then
bomb3:WaitForChild("PointLight").Enabled = true
end
if bomb3:FindFirstChild("Highlight") then
bomb3:WaitForChild("Highlight").Enabled = true
end
wait(val)
if not bomber then
return
end
if not bomber2 then
return
end
if not bomber3 then
return
end
val = val - 0.05
if bomb:FindFirstChild("PointLight") then
bomb:WaitForChild("PointLight").Enabled = false
end
if bomb:FindFirstChild("Highlight") then
bomb:WaitForChild("Highlight").Enabled = false
end
if bomb2:FindFirstChild("PointLight") then
bomb2:WaitForChild("PointLight").Enabled = false
end
if bomb2:FindFirstChild("Highlight") then
bomb2:WaitForChild("Highlight").Enabled = false
end
if bomb3:FindFirstChild("PointLight") then
bomb3:WaitForChild("PointLight").Enabled = false
end
if bomb3:FindFirstChild("Highlight") then
bomb3:WaitForChild("Highlight").Enabled = false
end
if val < val2 then
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Explosion" then
effect = bomb:FindFirstChild(v.Name)
if effect == nil then
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name == "Default" then
effect = v
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name ~= "Default" then
v:SetAttribute("Equipped", false)
end
end
end
end
end
end
end
end
end
end
for i, v in pairs(playereffect2.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Explosion" then
effect2 = bomb2:FindFirstChild(v.Name)
if effect2 == nil then
for i, v in pairs(playereffect2.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name == "Default" then
effect2 = v
for i, v in pairs(playereffect2.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name ~= "Default" then
v:SetAttribute("Equipped", false)
end
end
end
end
end
end
end
end
end
end
for i, v in pairs(playereffect3.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Explosion" then
effect3 = bomb3:FindFirstChild(v.Name)
if effect3 == nil then
for i, v in pairs(playereffect3.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name == "Default" then
effect3 = v
for i, v in pairs(playereffect3.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name ~= "Default" then
v:SetAttribute("Equipped", false)
end
end
end
end
end
end
end
end
end
end
if effect then
for i, v in pairs(effect:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
local sound = workspace:FindFirstChild(effect.Name)
if sound:IsA("Sound") then
sound:Play()
end
end
if effect2 then
for i, v in pairs(effect2:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
local sound2 = workspace:FindFirstChild(effect2.Name)
if sound2:IsA("Sound") then
sound2:Play()
end
end
if effect3 then
for i, v in pairs(effect3:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
local sound3 = workspace:FindFirstChild(effect3.Name)
if sound3:IsA("Sound") then
sound3:Play()
end
end
if bomber then
bomber.Humanoid:TakeDamage(bomber.Humanoid.Health)
end
if bomber2 then
bomber2.Humanoid:TakeDamage(bomber2.Humanoid.Health)
end
if bomber3 then
bomber3.Humanoid:TakeDamage(bomber3.Humanoid.Health)
end
if bomb then
bomb.Transparency = 1
for i, v in pairs(game.Teams.In:GetPlayers()) do
game.ReplicatedStorage.RemoteEvents.ExplosionRE:FireClient(v, (bomb.Position - v.Character.HumanoidRootPart.Position).Magnitude)
end
wait(3)
bomb:Destroy()
end
if bomb2 then
bomb2.Transparency = 1
for i, v in pairs(game.Teams.In:GetPlayers()) do
game.ReplicatedStorage.RemoteEvents.ExplosionRE:FireClient(v, (bomb2.Position - v.Character.HumanoidRootPart.Position).Magnitude)
end
wait(3)
bomb2:Destroy()
end
if bomb3 then
bomb3.Transparency = 1
for i, v in pairs(game.Teams.In:GetPlayers()) do
game.ReplicatedStorage.RemoteEvents.ExplosionRE:FireClient(v, (bomb3.Position - v.Character.HumanoidRootPart.Position).Magnitude)
end
wait(3)
bomb3:Destroy()
end
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients("The Bombs Have Exploded!")
local playerbomber = game.Players:GetPlayerFromCharacter(bomber)
if playerbomber then
if playerbomber then
playerbomber.Team = game.Teams.Out
end
end
local playerbomber2 = game.Players:GetPlayerFromCharacter(bomber2)
if playerbomber2 then
playerbomber2.Team = game.Teams.Out
end
local playerbomber3 = game.Players:GetPlayerFromCharacter(bomber3)
if playerbomber3 then
playerbomber3.Team = game.Teams.Out
end
wait(1)
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(#game.Teams.In:GetPlayers().." Players Remain")
break
end
end
end
end
end
end
else
if v.Team ~= game.Teams.In then
print("TEST 1")
return
end
bomber = v.Character
playereffect = v
print("CHOSE")
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(bomber.Name.." Has The Bomb!")
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Skin" then
bomb = game.ReplicatedStorage.Skins:FindFirstChild(v.Name):Clone()
bomb.Parent = workspace
end
end
end
--bomb.Position = v.Character.Torso.Position + Vector3.new(0, -7, 0)
local weld = Instance.new("Weld")
weld.Name = "BombWeld"
weld.Part0 = bomber.Torso
weld.Part1 = bomb
weld.C0 = CFrame.new(0,0.3,-2)
weld.C1 *= CFrame.Angles(math.pi/2,0,0)
--weld.C0 = CFrame.new(v.Character.Torso.Position, bomb.Position)
weld.Parent = bomb
local animation = Instance.new("Animation") -- Create Animation object
animation.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
local animationTrack = bomber.Humanoid:LoadAnimation(animation) -- Load the animation
animationTrack:Play() -- Play the animation
bomb.Touched:Connect(function(hit)
if db == false and bomb.Transparency == 0 then
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent ~= bomber then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.Team == game.Teams.In then
animationTrack:Stop()
animation:Destroy()
db = true
bomber = hit.Parent
weld.Part0 = bomber.Torso
animation = Instance.new("Animation") -- Create Animation object
animation.AnimationId = "rbxassetid://14010860032" -- Set the animation ID
animationTrack = bomber.Humanoid:LoadAnimation(animation) -- Load the animation
animationTrack:Play()
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(bomber.Name.." Has The Bomb!")
wait(0.5)
db = false
end
end
end
end
end
end)
local val = 1
local val2 = math.random(-1.3,-0.9)
while wait(val) do
if bomb:FindFirstChild("Sound") then
bomb:WaitForChild("Sound"):Play()
end
if bomb:FindFirstChild("PointLight") then
bomb:WaitForChild("PointLight").Enabled = true
end
if bomb:FindFirstChild("Highlight") then
bomb:WaitForChild("Highlight").Enabled = true
end
wait(val)
if not bomber then
return
end
val = val - 0.05
if bomb:FindFirstChild("PointLight") then
bomb:WaitForChild("PointLight").Enabled = false
end
if bomb:FindFirstChild("Highlight") then
bomb:WaitForChild("Highlight").Enabled = false
end
if val < val2 then
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v:GetAttribute("Equipped") then
if v.Value == "Explosion" then
effect = bomb:FindFirstChild(v.Name)
if effect == nil then
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name == "Default" then
effect = v
for i, v in pairs(playereffect.Inventory:GetChildren()) do
if v.Value == "Explosion" then
if v.Name ~= "Default" then
v:SetAttribute("Equipped", false)
end
end
end
end
end
end
end
end
end
end
if effect then
for i, v in pairs(effect:GetChildren()) do
if v:IsA("ParticleEmitter") then
v:Emit(v:GetAttribute("EmitCount"))
end
end
local sound = workspace:FindFirstChild(effect.Name)
if sound:IsA("Sound") then
sound:Play()
end
end
if bomber then
bomber.Humanoid:TakeDamage(bomber.Humanoid.Health)
end
if bomb then
bomb.Transparency = 1
for i, v in pairs(game.Teams.In:GetPlayers()) do
game.ReplicatedStorage.RemoteEvents.ExplosionRE:FireClient(v, (bomb.Position - v.Character.HumanoidRootPart.Position).Magnitude)
end
wait(3)
bomb:Destroy()
end
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients("The Bomb Has Exploded!")
local playerbomber = game.Players:GetPlayerFromCharacter(bomber)
if playerbomber then
if #game.Teams.In:GetPlayers() == 2 then
if game:GetService('MarketplaceService'):UserOwnsGamePassAsync(v.UserId, 192619237) then
playerbomber.Gold.Value = playerbomber.Gold.Value + 100
thirdPlace = playerbomber
game.ReplicatedStorage.RemoteEvents.Notification:FireClient(playerbomber, "100 Bomb Coins Have Been Added to Your Balance", Color3.fromRGB(255, 223, 42), Color3.fromRGB(255, 173, 57))
else
playerbomber.Gold.Value = playerbomber.Gold.Value + 50
thirdPlace = playerbomber
game.ReplicatedStorage.RemoteEvents.Notification:FireClient(playerbomber, "50 Bomb Coins Have Been Added to Your Balance", Color3.fromRGB(255, 223, 42), Color3.fromRGB(255, 173, 57))
end
elseif #game.Teams.In:GetPlayers() == 1 then
if game:GetService('MarketplaceService'):UserOwnsGamePassAsync(v.UserId, 192619237) then
playerbomber.Gold.Value = playerbomber.Gold.Value + 200
game.ReplicatedStorage.RemoteEvents.Notification:FireClient(playerbomber, "200 Bomb Coins Have Been Added to Your Balance", Color3.fromRGB(255, 223, 42), Color3.fromRGB(255, 173, 57))
secondPlace = playerbomber
else
playerbomber.Gold.Value = playerbomber.Gold.Value + 100
game.ReplicatedStorage.RemoteEvents.Notification:FireClient(playerbomber, "100 Bomb Coins Have Been Added to Your Balance", Color3.fromRGB(255, 223, 42), Color3.fromRGB(255, 173, 57))
secondPlace = playerbomber
end
else
if game:GetService('MarketplaceService'):UserOwnsGamePassAsync(v.UserId, 192619237) then
playerbomber.Gold.Value = playerbomber.Gold.Value + 50
game.ReplicatedStorage.RemoteEvents.Notification:FireClient(v, "50 Bomb Coins Have Been Added to Your Balance", Color3.fromRGB(255, 223, 42), Color3.fromRGB(255, 173, 57))
else
playerbomber.Gold.Value = playerbomber.Gold.Value + 25
game.ReplicatedStorage.RemoteEvents.Notification:FireClient(v, "25 Bomb Coins Have Been Added to Your Balance", Color3.fromRGB(255, 223, 42), Color3.fromRGB(255, 173, 57))
end
end
if playerbomber then
playerbomber.Team = game.Teams.Out
end
end
wait(1)
game.ReplicatedStorage.RemoteEvents.TextLabel:FireAllClients(#game.Teams.In:GetPlayers().." Players Remain")
break
end
end
end
end
wait(4)
end
end
end
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I looked on the dev hub and found nothing, and I don’t know what to try
I really need help because I have no clue why this is happening.