Part Deleter not working

local RainAmountWanted = 0

while true do

	wait()
	local Part = Instance.new("Part")
	Part.Size = Vector3.new(2,2,2)
	Part.Anchored = false
	Part.Position = Vector3.new(15,15,15)
	Part.Transparency = .3
	Part.Color = Color3.fromRGB(21, 134, 255)
	Part.Parent = game.Workspace
	RainAmountWanted = RainAmountWanted + 1
	Part.Touched:Connect(function()
		Part:Destroy()
	end)
end

Basically, it is a way of deleting parts that touched the ground, so the thing can go forever.

But for some reason it only spawns 1 part then bugs out.

any idea what is going on?

kinda hard to figure out the problem when you are still learning how to script

It might be because the parts are spawning simultaneously at the same place, causing the part to be destroyed right when they spawn. You could try setting the position of the Part to be random (but within a limited range). And you should also avoid the use of wait(), instead using task.wait(). Read more at evaera’s article: https://eryn.io/gist/3db84579866c099cdd5bb2ff37947cec

Can you Please give us the error if you said the script errors? It would give us more info and be easier for us to assist you in need.

use task.wait() FYI. wait() is old.