This script runs an explosion. I want it to execute after a certain and I want the timer to start when the first player joins. Then I want that to run over and over again so the explosions repeat. How would I do 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)



2 comments

0

You didn't even try to make it like so. Try making it for yourself, and if it doesn't work then come back and ask why it isn't working.

0

@zamd157 They tried, don't be so racist.