I know this is a long piece of code but the only part that I think is affecting it is the bottom part. For whatever reason after my explosion occurs the explosive decides to get rid of itself. I can't find why this would be in my code and I need help.
sp=script.Parent
triggered=false
sp.Explode.Changed:connect(function()
if sp.Explode.Value and not triggered then
triggered=true
wait(.1)
game.Debris:AddItem(sp,.1)
sp.Transparency=1
local e=Instance.new("Explosion")
e.Hit:connect(function(hit)
if hit and hit.Parent~=nil then
local et=hit:FindFirstChild("Explode")
if et then
if not et.Value then
et.Value=true
end
end
if hit.Parent:FindFirstChild("RobloxStamper") or hit.Parent:FindFirstChild("RobloxModel") then
game:GetService("Debris"):AddItem(hit.Parent,10)
end
end
end)
local blastradius=1000
if sp:FindFirstChild("Configuration") then
blastradius=sp.Configuration.BlastRadius.Value
end
e.Position=sp.Position
e.BlastPressure=2000000
e.BlastRadius=blastradius
e.Parent=game.Workspace
wait(.1)
sp.parent:Clone()
end
end)
sp.Trigger.SourceValueChanged:connect(function(val)
if val>.5 then
sp.Explode.Value=true
end
end)

2 comments
Lines, 9 and 21 call scheduled removals; the only thing I see contradicting is the removal of sp at line 9\
Lines, 9 and 21 call scheduled removals; the only thing I see contradicting is the removal of sp at line 9.