part = script.Parent Rand = math.random(0,10) while true do for i = 1,30 do part.CFrame = part.CFrame+Vector3.new(Rand,0,Rand) wait() end wait(2) for i = 1,30 do part.CFrame = part.CFrame-Vector3.new(Rand,0,Rand) wait() end wait(2) end
You assigned Rand as a random from 0 to 10, so the result is random, but the result is already generated and will be the same everytime you use it. If the result is 6, everytime you call the variable Rand it will return 6. You have to assign math.random() on x and a new math.random() on z instead. Or at least put Rand inside the loop so it renews Rand everytime the loop happens.