|
| 02 Jan 2015 10:12 PM |
I have this script that's supposed to rotate a part but when I rotate the model with the part and I test it, the part comes off the model, how can I fix this?
function onClick() local part = script.Parent.Parent.Parent.part for i = 1,100 do part.CFrame = part.CFrame * CFrame.Angles(0,0,math.rad(0.1)) wait() end end script.Parent.ClickDetector.MouseClick:connect(onClick) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 02 Jan 2015 10:42 PM |
I tried:
part.CFrame = CFrame.new(part.CFrame.lookVector) * CFrame.Angles(0,0,math.rad(0.1))
But that just made it worse, how can I fix this so that it rotates according to the objects "x" axis?
|
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 02 Jan 2015 10:44 PM |
| It's weird that it does that but get get the initial CFrame from the part's relative position from another part in the model (and acquire this before the loop starts). |
|
|
| Report Abuse |
|
|
|
| 02 Jan 2015 10:47 PM |
| Ah ok, thanks! I managed to fix it now. |
|
|
| Report Abuse |
|
|