function onClicked()
while true do
for i = 1, 20 do
script.Parent.brick1to20 = Instance.new("Part")
script.Parent.brick1to20.BrickColor = BrickColor.new("Bright blue")
script.Parent.brick1to20.Transparency = 0.5
script.Parent.brick1to20.Shape = "Ball"
wait(2)
script.Parent.brick1to20.Name = "MyBrickNumber" .. tostring(i)
script.Parent.brick1to20.Parent = game.Workspace
script.Parent.brick1to20:remove()
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
end
It's not working for some reason. I'm trying to make it where you have to click to turn on the fountain. It does not say anything in the output and it's just plain not working.

3 comments
Put your code in a code block, to make it easier to read.
It's in a code block now.
What is "script.Parent.brick1to20"? It appears as if you are trying to use an object as a variable.