Basically, I want the Part to move to that CFrame, then after 5 seconds, to come back. However, When Part Teleports Back, It also changed it's orientation, I tried to do
script.Parent.Orientation but it didn't work, anyone knows what's the issue?
1 | local click = script.Parent.ClickDetector |
2 |
3 |
4 | click.MouseClick:Connect( function (click) |
5 | print ( "I got clicked" ) |
6 | script.Parent.CFrame = CFrame.new( 1273.907 , 237.592 , - 668.21 ) |
7 | wait( 5 ) |
8 | script.Parent.CFrame = CFrame.new( 1284.227 , 237.592 , - 668.21 ) |
9 | end ) |
The issue is that CFrames contain orientation data. Creating a CFrame creates a blank orientation,(0,0,0
i think). Try using a part with the orientation and position u want:
01 | local part = -- put the part with the desired end orientation and position. It should be transparent and cancollide-false. |
02 |
03 | local click = script.Parent.ClickDetector |
04 |
05 | click.MouseClick:Connect( function (click) |
06 | print ( "I got clicked" ) |
07 | script.Parent.CFrame = part.CFrame |
08 | wait( 5 ) |
09 | script.Parent.CFrame = CFrame.new( 1284.227 , 237.592 , - 668.21 ) |
10 | end ) |