Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Rotating a model without it changing its Vector3 position?

Asked by
Plieax 66
5 years ago

I have tried using this code but it moves the Vector3 position of the primary part, so the lightning won't go to the right place, please help

clone.lightning_g:SetPrimaryPartCFrame(CFrame.Angles(0,180,0))

1 answer

Log in to vote
2
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
5 years ago

You're setting it to position 0,0,0 because CFrame.Angles() is only the rotation. You can fix this by taking the current CFrame and multiplying the angle onto that CFrame.

Also, you'll have to use math.deg(180) seeing that CFrame.Angles uses Radians instead of Degrees.

You can use the following code.

clone.lighting_G:SetPrimaryPartCFrame(clone.lighting_G.CFrame * CFrame.Angles(0,math.rad(180),0))

Ad

Answer this question