Script causes explosion multiple times on one part and more issues

So I am attempting to make a script where once you push a button, explosions happen at multiple parts and after the song has stopped playing, the explosions stop.

local assetid = 6005200754
game.Players.PlayerAdded:connect(function(player)
	local MarketplaceService = Game:GetService('MarketplaceService')
	--THE ABOVE IS IRRELEVENT
	script.Parent.ProximityPrompt.Triggered:Connect(function(player)	
		if MarketplaceService:PlayerOwnsAsset(player, assetid) then	
			script.Parent.ProximityPrompt.Enabled = false			
			script.Parent.Parent.other.ProximityPrompt.Enabled = false		
			workspace.UhOh:Play()
            workspace.German.Value = true			
			wait(49.93)
			if workspace.German.Value == true then
			while true do	
			wait()
			local children = game.Workspace:GetChildren()	
				for i = 1, #children do		
				local child = children[i]
				if child:IsA("BasePart") then	
				local e = Instance.new("Explosion")			
				e.BlastRadius = 50
				e.BlastPressure = 60000000
				e.Parent = child
				e.Position = child.Position
				end			
				end	
				end
			if workspace.UhOh.Playing == false then
				script.Parent.ProximityPrompt.Enabled = true
			workspace.German.Value = false
		else
			game:GetService("MarketplaceService"):PromptPurchase(player, assetid)	
			end
			end
			end
	end)
end)

But once the song stops playing, the explosions still occur and I think the explosions THEN happen at random places.

Can anybody help me on this?
Thanks :grinning:

1 Like

Nevermind, I fixed it myself just by altering the script.