✓ Accepted answer
'Position' is a Vector3 property, not a CFrame one. You could use 'CFrame' in place of 'Position' to avoid the built-in collision check for 'Vector3.'
I wouldn't put them in the same 'for' loop, but that depends what you want the loop to do.
If you want the script to have Mover1 move about 5 units, waits for 2 seconds, then move 5 units back, then consider coding the script this way:
while true do
wait(3)
for i = 1, 5 do
game.Workspace.Mover1.CFrame = game.Workspace.Mover1.CFrame * CFrame.new(0,0,1)
end
wait(2)
for i = 1, 5 do
game.Workspace.Mover1.CFrame = game.Workspace.Mover1.CFrame * CFrame.new(0,0,-1)
end
end
Otherwise, if you want the script to wait for 3 seconds, have Mover1 to move 1 unit, wait for 2 seconds, then move 1 unit back five times, then consider coding the script this way:
while true do
wait(3)
for i = 1, 5 do
game.Workspace.Mover1.CFrame = game.Workspace.Mover1.CFrame * CFrame.new(0,0,1)
wait(2)
game.Workspace.Mover1.CFrame = game.Workspace.Mover1.CFrame * CFrame.new(0,0,-1)
end
end
2 comments
That helped but now my brick moves all the way to the center of my game.
thats because you set the position to the coordinates 0,0,1. My way on finding coordinates in your world is to get a 1x1 part, then place it where you want it, and the position property has the 3 numbers, which are Vector3