Rotation problem with part?
04 | script.Parent.CFrame = CFrame.new(script.Parent.Position.X, 13.5 , script.Parent.Position.Z) |
05 | script.Parent.Rotation = Vector 3. new( 0 , 90 , 0 ) |
10 | script.Parent.CFrame = script.Parent.CFrame + Vector 3. new( 0 , . 5 , 0 ) |
15 | script.Parent.CFrame = script.Parent.CFrame - Vector 3. new( 0 , . 5 , 0 ) |
This script makes a part go up and down, and after each loop, it resets the part to a certain point on the Y axis, while not affecting the other axes. When I tested the script, every time it reset positions, it would also reset the rotation to (0, 0, 0). I want it facing a certain way, so I added a line of code that changes the rotation after each loop. However, after each loop, the part rotates correctly but fails to reset to 13.5 (it resets to 20 instead). My best guess is that the part collides with a brick at the area it is supposed to reset to, so it resets to an area that doesn't collide with any bricks. Any way to fix it that doesn't involve getting rid of any collisions?
EDIT: Testing reveals that the brick collision is the source of the problem. I can't find a solution, however.