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

Rotating Brick goes to 0,0,0?

Asked by 7 years ago

Hello! I'm having an issue with a script. When I run the script, the brick teleports to 0,0,0. I'm using CFrame.Angles to practice with every CFrame.

part = script.Parent 
    a = 0
    repeat
    part.CFrame = CFrame.Angles( 0, a, 0) 
    wait(.01) 
    a = a+3 
until unAssigned == 1 

1 answer

Log in to vote
0
Answered by
evaera 8028 Trusted Badge of Merit Snack Break Game Jam Winner Moderation Voter Administrator Community Moderator Super Administrator
7 years ago

This is happening because you are setting the CFrame and not modifying it. CFrame.Angles returns a CFrame object with blank positional data. That's why it's going to 0, 0, 0.

You need to translate the original CFrame by using the * operator, like so:

part.CFrame = part.CFrame * CFrame.Angles(0, a, 0)
Ad

Answer this question