Weld Rotation (Updated)

Hello, I’ve got a welded object that I’m trying rotate.

The Code:

RS.RenderStepped:Connect(function(Delta)
	C1Rotation = C1Rotation + 0.35
	BeyBlade.Engine.Weld.C1 = CFrame.Angles(0,C1Rotation,0)
end)

The Welding Code:

for i,v in pairs(script.Parent.Parent:GetDescendants()) do
	if v:IsA('BasePart') then
		if v.Name ~= 'Engine' and v.Name ~= '1' then
			local Weld = Instance.new('Weld')
			Weld.Parent = v
			Weld.Part0 = BayBlade['1']
			Weld.Part1 = v
			Weld.C0 = BayBlade.Engine.CFrame:Inverse() * v.CFrame
		elseif v.Name == 'Engine' then
			local SpinWeld = Instance.new('Weld', BayBlade.Engine)
			SpinWeld.Part0 = BayBlade.Engine
			SpinWeld.Part1 = BayBlade["1"]
			SpinWeld.C0 = CFrame.new(0, -0.47, 0)
		end
	end
end

Above is the video of what happens.
Everything in the body is welded to a spin part and that part is welded to the “Engine” part.
Currently, the only part that spins is the “Engine” Part, which you can see in the video, I’m trying to have the rest of the parts welded to it to rotate as well.
Any help is appreciated!

1 Like

What exactly is C1? If you’re trying to rotate the model, set a PrimaryPart, and use CFrame.Angles() on its CFrame. Here’s a sample:

local model = BeyBlade.Engine
local primaryPart = model.PrimaryPart --set PrimaryPart beforehand (properties)

RS.RenderStepped:Connect(function(Delta)
    C1Rotation += .35
    model:SetPrimaryPartCFrame(primaryPart.CFrame * CFrame.Angles(0, math.rad(C1Rotation), 0))
end)

I’m not trying to rotate the whole model, just a group of welded parts inside the model.

You could group these welded parts into a model.

I edited the question since I realised I wasn’t giving enough information on the problem.

Hi Johan,

I would recommend creating an anchored root part–a part that is stationary. You can then weld the engine to that root part, and update the C0 weld between the two to rotate the entire piece. You will have to change your welds to motors.

local weld = Instance.new("Motor")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new()

When you rotate the main motor, the CFrame change propagates to your engine, then to the rest of your visual parts.

If you cannot afford to anchor the parts, I would recommend welding to keep the parts first, then using a BodyGyro and a BodyAngularVelocity to hold the orientation of the item and to keep it spinning.

1 Like

I’m already using a BodyGyro to rotate the whole model to face where the camera is pointing, which is why I need to use the Weld’s C1 to rotate.