I was messing around with a script because I had recently just learned some basic functions and I wanted to make a randomized position for every couple seconds. I made this while true do loop and it won't loop. What did I do wrong?
The part spawns, then teleports to a random area within 100 studs, and stops. That's all. Why won't the script loop?
function partNew(color,transparency,position,name)
local part = Instance.new("Part")
part.Name = name
part.BrickColor = color
part.Transparency = transparency
part.Reflectance = 0
part.Anchored = true
part.CanCollide = true
part.Position = position
part.Parent = workspace
return part
end
local one = partNew(BrickColor.Random(),0.5,Vector3.new(1,1,1),"PartOne")
local randVec = Vector3.new(math.random(100), y, math.random(100))
while true do
one.Position = randVec
wait(1)
end

3 comments
did the script enconter any erors ?
The "randVec" should be inside the loop, so it will change it's value each run.
And, is the variable "y" defined?