Rotating a part with other parts attached to it not working

I got 3 parts here. Without making them one part, I’d like to rotate the middle part.

Imgur

Would like the other 2 parts to rotate with it.

Imgur

Tried everything I can think of nothing seems to work.
Want to make a function I can send an angle to the middle part.
Really don’t understand why this is so hard to figure out.

This is the real item welded together …
Imgur
Two rockets and a Axel, 3 parts …

2 Likes

There is 2 solutions to do this:

  • Group all parts into a model, select the middle as primaryPart and use PivotTo to the model to do whatever you want with.

  • Weld all these parts together and use CFrame to manipulate one of them, so all the other parts will still be welded. Using Vector3 Position or orientation is destroying welds.

1 Like

When I rotate the middle part it moves as I want but, nothing else follows.
Tried weld and weldconstraints … Need to try that 1st way you said now.

1 Like

And you are rotating the middle part using CFrame in your script ?

1 Like

like this

local part = workspace.Rockets.PrimaryPart
local rotation = CFrame.Angles(math.rad(45), 0, 0)
part.CFrame = part.CFrame * rotation

This isn’t working … the reason I posted.
Tried a few way …

1 Like

It work for me, here is an example:

The three parts

WeldConstraint Properties
Capture2

Script

local Value = 0
while wait(0.05)do
	Value += 0.01
	script.Parent.CFrame = script.Parent.CFrame * CFrame.fromOrientation(0, Value, 0)
end

I just did the 1st option you said … and in a model this works.

local a = math.rad(45)
local p = workspace.Rockets
p:SetPrimaryPartCFrame(p.PrimaryPart.CFrame * CFrame.Angles(a, 0, 0))

But I’ll try the other too.

I said you need to use PivotTo while doing it on a model lol

local Model = workspace.Rockets
Model:PivotTo(Model.PrimaryPart.CFrame * CFrame.Angles(math.rad(45), 0, 0))

The post don’t work … it movesthe part on the wrong axis and it isn’t moving all them.
looks just like all the scripts and ways I tried … it would be (Value, 0, 0) if it worked.

But the first suggestion worked …

This way with this script works also. Thank you!
This is the way I was going for also.

Now I need you to fully explain how to tween this …
lol, jk … thanks again!

In case anyone is interested … finished function()
I was so close …

task.wait(3) -- so i can see it happen

local Model = workspace.Rocket
local TweenService = game:GetService("TweenService")

function rot(rockets, speed, angle)
	local targetRotation = Vector3.new(angle, 0, 0)
	local tweenInfo = TweenInfo.new(speed, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
	local tween = TweenService:Create(rockets.PrimaryPart, tweenInfo, 
		{CFrame = rockets.PrimaryPart.CFrame * CFrame.Angles(math.rad(targetRotation.x), 0, 0)})
	tween:Play()
end

rot(Model, 3, 90)
task.wait(4)
rot(Model, 3, -90)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.