This is probably simple, but I just learned about CFrame. I'm trying to make the part this script is in, Move up and down over and over in the current position it is already in. This does not seem to loop.
function movement() while true do wait() for y = -5,5, 0.1 do script.Parent.CFrame = CFrame.new(-98, 1.7, -15) * CFrame.new(0, y, 0) end end end movement()
Is there another way to move my part from a position instead of assigning it to stay in the X axis and Y axis above? i.e. if I dragged this part somewhere else, It stays there not moves(Minus Up and Down)
The problem is you didn't put a yeild in your for loop - It would just immediately get stuck somewhere. Try this
function movement() local down = false while wait() do down = not down for y = 1,10 do wait(.05) if down then num = -.1 else num = .1 end script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,num,0) end end end movement()