z = math.random(-24,24)
t = math.random(.009,.05)
NewPart = Instance.new("Part")
for i = 1, 900 do
NewPart.Parent = Workspace
NewPart.Size = Vector3.new(3.6, 1.2, 2)
NewPart.Position = Vector3.new(22, 18.19, z)
NewPart.BrickColor = BrickColor.new("Really black")
for i = 1,146 do
NewPart.CFrame = NewPart.CFrame* CFrame.new(0,.2,0)
wait(t)
end
NewPart.remove()
wait(5)
end
Every 5 seconds, it is supposed to create one block with a random Z vector as shown at the very top. It only creates one block, and then the script stops. I think it's the NewPart.remove() , but I'm not sure. What could I try instead of that?

5 comments
Thank you! I must've accidentally done that, and then missed it while proof reading.
Happy to help!
Oh, there's also another problem. It doesn't recalculate the random Z value. Could you help me with that as well?
I have changed my post. It should now generate a new part with a new z value every time the first for loop scope runs.
Thanks, it does.