I have this explosion script that works on exploding things. I want it to explode a certain amount of time starting from when one player joins the server. I also want the explosion to repeat after a certain time over and over again. How would I go about doing that?
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:remove()
end
end)
sp.Trigger.SourceValueChanged:connect(function(val)
if val>.5 then
sp.Explode.Value=true
end
end)
