script.Parent.Button.ClickDetector.MouseClick:connect(function()
	script.Parent.Button.CFrame = CFrame.new(1.9, 5.225, -22.06)
	script.Parent.Button.Rotation = Vector3.new(-90, 90, 0)
	script.Parent.broke.Transparency = 0.45
	script.Parent.Glass1.Transparency = 1
	wait(0.5)
	script.Parent.Button.Rotation = Vector3.new(-90, 90, 0)
	script.Parent.Button.CFrame = CFrame.new(1.9, 5.145, -22.06)
	script.Parent.Button.Rotation = Vector3.new(-90, 90, 0)
	for i = 0, 200, 0.5 do
		print(i)
		for _, v in pairs(game.Players:GetChildren()) do
			if (v.Character.Torso.Position - script.Parent.Center.Position).magnitude <= i then
				for o, b in pairs(v.Character:GetChildren()) do
					if b:IsA("Part") then
						local s = b:FindFirstChild("Destroy12")
						if not s then
						local die = game.ReplicatedStorage.Destroy12:Clone()
						die.Parent = b
						else
							break
						end
						b.BrickColor = BrickColor.new("Really red")
						b.Material = "CorrodedMetal"
					elseif
						b:IsA("Hat")then
						b:Destroy()					
					end
				end
			end
		end
		for _, v in pairs(game.Workspace:GetChildren()) do
			if v:IsA("Part") or v:IsA("UnionOperation") and v.Name ~= "Baseplate" then
				if (v.Position - script.Parent.Center.Position).magnitude <= i then
					local die = game.ReplicatedStorage.Destroy12:Clone()
					die.Parent = v
					v.BrickColor = BrickColor.new("Really red")
					v.Material = "CorrodedMetal"
				end
			elseif v:IsA("Model") then
				for o, b in pairs(v:GetChildren()) do
					if b:IsA("Part") or b:IsA("UnionOperation") then
						local die = game.ReplicatedStorage.Destroy12:Clone()
						die.Parent = b
						b.BrickColor = BrickColor.new("Really red")
						b.Material = "CorrodedMetal"
					end
				end
			end
		end
		wait(0.1)
	end
end)

I'm sorry this isn't a question, I'm also not using my real account because I can't really recover my original SH account, because of gateway errors.

Anyways, this is my script;

Im having problems with the lines 17 to 23, I try to stop the script spamming if a brick already has the script, but it doesn't work. It keeps spamming. I can't see the problem: Please help!

2 comments

0

Please, click the lua button on the top right, and put all the code inside of what pops up

0

Sorry about that