I have a part that is anchored and CanCollide true. This is a server script inside of it. It should make the part move forward, but it gradually moves diagonally.
1 | local part = script.Parent |
2 | while true do |
3 | wait( 0.01 ) |
4 | part.CFrame = part.CFrame - Vector 3. new( 0 , 0 , 6 ) |
5 | end |
If the part is rotated, it'll make it go diagonally as adding a Vector3 moves it using the global axes. To move it on the local axises, use cf * cf:
1 | part.CFrame = part.CFrame * CFrame.new(-Vector 3. new( 0 , 0 , 6 )) |
2 | -- or |
3 | part.CFrame = part.CFrame * CFrame.new( 0 , 0 ,- 6 ) |