For some reason there’s an extra explosion part in the vicinity of the wanted explosion.
here’s a pic: (the one with just a forcefield is the one I want out)
I really have no idea what’s causing this.
Here’s the code for the explosion. Portal is the projectile that exploded, Expl1 and Expl2 is the inner and outer circle. Expl2 is the outer one.
local Portal = game.ServerStorage:WaitForChild("Portal")
local PartP = script.Parent
local Expl1 = game.ServerStorage:WaitForChild("Explosion")
local Expl2 = Expl1:WaitForChild("Part")
game.ReplicatedStorage.Portal.OnServerEvent:connect(function(player)
local char = player.Character
local NewPortal = Portal:Clone()
local NewExpl = Expl2:Clone()
local NewExpl2 = Expl1:Clone()
local offset = Vector3.new(0,0,-4)
NewPortal.CFrame = char.HumanoidRootPart.CFrame*CFrame.new(offset)
local bVel = Instance.new("BodyVelocity")
bVel.MaxForce = Vector3.new(1000000000,math.huge,1000000000)
bVel.Velocity = (char.HumanoidRootPart.CFrame.lookVector*250)
bVel.Parent = NewPortal
NewPortal.Parent = workspace
NewPortal.CanCollide = false
wait(0.03)
NewPortal.CanCollide = true
local touchConnect
--[[On hit]]--
touchConnect = NewPortal.Touched:connect(function(hit)
--print("Projectile has touched", hit.Name)
if hit then
wait()
NewPortal:Destroy()
NewExpl.CFrame = NewPortal.CFrame
NewExpl.Parent = workspace
NewExpl2.CFrame = NewPortal.CFrame
NewExpl2.Parent = workspace
NewExpl.Anchored = true
NewExpl2.Anchored = true
wait(4)
NewExpl2:Destroy()
NewExpl:Destroy()
touchConnect:Disconnect()
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent ~= player.Name then
hit.Parent:BreakJoints()
if touchConnect ~= nil then touchConnect:Disconnect() end
NewPortal:Destroy()
end
end
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent ~= player.Name then
hit.Parent:BreakJoints()
if touchConnect ~= nil then touchConnect:Disconnect() end
NewPortal:Destroy()
end
end
end
end)
wait(2)
if touchConnect ~= nil then touchConnect:Disconnect() end
NewPortal:Destroy()
end)