I was creating a script for one of my bombs and for some reason, when It gets to this one event it never fires the function I put in place. It just prints 152 and then never goes from there.
There are no errors and I’m not really sure on what I should do.
Event
ActivateBombRemote.OnServerEvent:Connect(function(user) -- This is the function that makes the bomb go off, which connects the ActivateBomb Remote Event to this script after it gets activated by the local script.
print("wkjdvrhejhced")
local bombClone = bombHandle:Clone()
bombClone.Parent = game.Workspace
bombClone.CanCollide = true
bombClone.CFrame = bombHandle.CFrame * CFrame.new(0, 2, 2)
print("urivjsectgyo yooyo gob jroufi oy7r3 8298 01 2") -- Line 152
explode(bombClone, user)
print("e")
end)
Function
function explode(bomb, user)
for i = 1, 3 do task.wait(33.4)
tickSound:Play()
print("8281923")
end
print("o")
task.wait(1)
bomb.Anchored = true -- Anchores the bomb so that it doesn't go elsewhere due to the explosion.
local explosionParticle = explosionParticles(bomb)
local explosionSoundClone = explosionSound:Clone()
explosionSoundClone.Parent = bomb
explosionSoundClone:Play()
explosionSound:Play()
bomb.Transparency = 1
local region3 = Region3.new(
bomb.Position - Vector3.new(blastRegion3L, blastRegion3H, blastRegion3W),
bomb.Position + Vector3.new(blastRegion3L, blastRegion3H, blastRegion3W) -- Makes a square that is 5x5 long and wide, and 10 studs high (hence the 1 to 10)
) -- Creates a region3 that destroys any parts in the explosions radius.
local region3Visual = Instance.new("Part") -- The visualized part for the region3.
region3Visual.Name = "blastRadiousVisual"
region3Visual.CanCollide = false
region3Visual.Size = region3.Size
region3Visual.CFrame = region3.CFrame
region3Visual.Anchored = true
region3Visual.Transparency = .5
region3Visual.Parent = workspace.Terrain
region3Visual.BrickColor = BrickColor.new("Persimmon")
print("ocvbrtbjuybythtvyt")
local explosion = Instance.new("Explosion") -- The explosion instance
explosion.Parent = bomb
explosion.Position = bomb.Position
explosion.BlastRadius = 0
explosion.DestroyJointRadiusPercent = 0
explosion.BlastPressure = 0
explosion.BlastRadius = blastRegion3L
local overlapParams = OverlapParams.new()
overlapParams.FilterDescendantsInstances = {tool, tool.Handle, region3Visual}
local parts = workspace:GetPartBoundsInBox(region3.CFrame, region3.Size, overlapParams)
explosion.Hit:Connect(function(Part)
if Part.Name == "HumanoidRootPart" then
local character = Part.Parent
local player = game.Players:GetPlayerFromCharacter(character)
if player --[[ and player.Team ~= user.Team then ]] then
character:FindFirstChildOfClass("Humanoid"):TakeDamage(baseDamage)
local animation = character:WaitForChild("Humanoid"):LoadAnimation(tool.DanceAnimation)
local sound = bomb:FindFirstChild("Music")
animation:Play()
sound:Play()
character:WaitForChild("Humanoid").WalkSpeed *= .5
character:WaitForChild("Humanoid").JumpPower *= .5
wait(8)
animation:Stop()
sound:Stop()
character:WaitForChild("Humanoid").WalkSpeed *= 1
character:WaitForChild("Humanoid").JumpPower *= 1
if character:FindFirstChildOfClass("Humanoid").Health == 0 then
user.leaderstats.Kills.Value += 1
end
end
end
end)
for i, v in pairs(parts) do
if v.Name == "Brick" then
v.Anchored = false
v.CanTouch = false
v.BrickColor = user.TeamColor
for i, constraint in pairs(v:GetChildren()) do
if constraint:IsA("Snap") or constraint:IsA("Weld") or constraint:IsA("WeldConstraint") then
constraint:Destroy()
end
end
task.delay(2, game.Destroy, v)
end
if v.Name == "GameBrick" then v.Name = "TaggedGameBrick" -- TaggedGameBricks are GameBricks in the game that have been effected by the bomb, while regular Bricks are just bricks you can destroy by default.
v.Anchored = false
v.CanTouch = false
user.leaderstats.Bricks.Value += 1 -- The total bricks the player has broken throughout the round.
user["T. Bricks"].Value += 1 -- The total bricks that the player has destroyed throughout there playtime
user.leaderstats.Studs.Value += .1 -- Increases the players currency (Studs) by 0.1.
v.BrickColor = user.TeamColor -- Changes the taggedBricks color to the local players team color to show that they have broken the part.
task.delay(2, game.Destroy, v) -- later deletes the part.
end
end
task.delay(3, game.Destroy, bomb)
task.delay(3, game.Destroy, region3Visual)
task.wait(2)
explosionParticle.Enabled = false -- Disables the explosion particles.
end