It has something to do with line 17 - 20 with the error of "Players.snipperdiaper.PlayerGui. NewInstances!.TextButton.LocalScript:20: attempt to call a nil value"
local Button = script.Parent
local Spawning = false
Button.MouseButton1Click:Connect(function()
if Spawning then
while true do
wait(0.2)
local NewPart = Instance.new("Part")
Spawning = true
NewPart.Name = "NewDestruction"
NewPart.Parent = workspace
end
else
Spawning = false
local DestroyP = game.Workspace:GetChildren("NewDestruction")
DestroyP:Destroy()
end
end)
-Thanks in advance, snipperdiaper

1 comment
Okay so I was trying to do a loop while the spawning was true (which would keep spawning the bricks until it was false) which I tried to fix but it didnt work.