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

Can Parts simultaneously change position while rotating?

Asked by 5 years ago

I have a model that gets a number added to its position every 0.01 seconds, and in that model is one part that rotates by Y every 0.01 seconds. My script seems to not want to do these 2 things at once. Is this how this works? Is there a workaround?

0
Show your code pidgey 548 — 5y

1 answer

Log in to vote
0
Answered by
mc3334 649 Moderation Voter
5 years ago
Edited 5 years ago

Yes! They can. The easiest way to do this with a part, we will assume its anchored since you didn't specify, if setting the CFrame. In your example, we would do something like this:

Model = *Model Instance*
AddInterval = *Integer to move the model by, EX: 1*
RotateInterval = *Integer to rotate the model by (IN DEGREES), EX: 5*
while wait(0.01) do
    Model:SetPrimaryPartCFrame(Model.PrimaryPart.CFrame+(CFrame.new(AddInterval,AddInterval,AddInterval)*CFrame.Angles(0,math.rad(RotateInterval),0)))
end

Just fill in the variables at the top. If you meant when the part isn't anchored, then comment and ill provide a solution for that.

EDIT: MAKE SURE THE MODEL HAS A PRIMARY PART!!!

Ad

Answer this question