What I want it to do is when the gate gets destroyed it blows up and puts some of its parts down then destroys the parts and the gate is broken until someone repairs it however its repeating.Thanks for the help ahead of time

local wall = script.Parent.Humanoid
local model = script.Parent.Model
script.Parent.Humanoid.Value.Changed:Connect(function()
	if script.Parent.Humanoid.Value.Value <= 0 then
		for num, child in pairs(model:GetChildren()) do
			print("1")
			child.Transparency = 1
			script.Parent.Head.Transparency = 1
		local boom = Instance.new("Explosion")
			boom.Parent = game.Workspace.Gate
			boom.Position = game.Workspace.Gate.Gate.Head.Position
			local part1 = game.ReplicatedStorage.ExplosiveParts.cone:clone()
			local part2 = game.ReplicatedStorage.ExplosiveParts.Explosive1:clone()
			local part3 = game.ReplicatedStorage.ExplosiveParts.Explosive2:clone()
			local part4 = game.ReplicatedStorage.ExplosiveParts.Explosive3:clone()
			local part5 = game.ReplicatedStorage.ExplosiveParts.Explosive4:clone()
			part1.Parent = game.Workspace.ExplosivePartWorkspace
			part2.Parent = game.Workspace.ExplosivePartWorkspace
			part3.Parent = game.Workspace.ExplosivePartWorkspace
			part4.Parent = game.Workspace.ExplosivePartWorkspace
			part5.Parent = game.Workspace.ExplosivePartWorkspace
			part1.Position = game.Workspace.Gate.Gate.Head.Position
			part2.Position = game.Workspace.Gate.Gate.Head.Position
			part3.Position = game.Workspace.Gate.Gate.Head.Position
			part4.Position = game.Workspace.Gate.Gate.Head.Position
			part5.Position = game.Workspace.Gate.Gate.Head.Position
				script.Parent.Head.CanCollide = false
				wait(5)
			part1:Destroy()
			part2:Destroy()
			part3:Destroy()
			part4:Destroy()
			part5:Destroy()

			end
	end
	end)

2 comments

1

Because it's in a for loop.

0

how do I make it so it doesnt loop