Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to keep a Single Direction using CFrame?

How would I go about moving a part in a Single Direction using a CFrame to the right, while that part is being rotated on the x Axis?

for i = 1,10 do
part.CFrame = part.CFrame * CFrame.new(0.1,0,0)
part.CFrame = part.CFrame * CFrame.Angles(0.1,0,0)
end

As the following code would change the direction of it's movement, due to the angle change

1 comment

0

Not tested, but try adding a Vector3. 'part.CFrame = part.CFrame + Vector3.new(0.1, 0, 0)

2 answers

I found this worked in any direction

for i = 1,10 do
part.CFrame=(part.CFrame+Vector3.new(0.1,0,0))*CFrame.Angles(0.1,0,0)
wait()
end

1 comment

0

But I need to add a CFrame to it, not a Vector3, so I can CFrame it to it's right side, then have it continue that direction while rotating

You can add multiple cframe conditions, as SirGory demonstrated above:

part.CFrame = part.CFrame * CFrame.new(0.1,0,0) * CFrame.Angles(0.1,0,0)

This discussion is preserved as it was. New answers, comments, and votes are closed.