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

How can I keep a brick constantly rotated in a for loop?

Asked by 9 years ago

I'll set the rotation by using

p.CFrame = player.Character.Torso.CFrame *CFrame.Angles(90, 0, 90)

p being the part.

Then when I use the for loop, it will lose rotation when I add this part:

p.CFrame = player.Character.Torso.CFrame *CFrame.new(0, 0, 0)

But I need to add that in or the brick will go above the character

How can I get the brick to stay at it's rotation?

When I add *CFrame.Angles(90, 0, 90) it won't go directly at a 90 degree angle. It needs to be flat, and there's a mesh in it that by default is vertical, so that's why I need to have it rotated, but it never stays rotated.

1 answer

Log in to vote
0
Answered by
Noculus 25
9 years ago

A for loop is not very useful for keeping an object constantly spinning.

If you want this object to keep spinning until a condition occurs, use:

repeat
    --Whatever you want to repeat
until --Condition

If you want this object to keep spinning forever, use:

while true do
    --Whatever you want to repeat
end
Ad

Answer this question