Rotation Issue/question

Okay so basically I am trying to get the Arm of this light to pivot left or right while the head follows the arm which can move up or down depending on PlaybackLoudness. This is how its supposed to be upright.

This is what it’s wanting to do which I’m obviously not understanding why. I know the issue retains to a bad pivot.

image

But could someone take the time to explain what I am not understanding when it comes to stuff like this?

function lights()
	local children = workspace.Lighting_System.Lights:GetChildren()
	local color = rgbs[count]
	for i = 1,#children do
		local frame = children[i].Head.Head.CFrame
		local Arm = children[i].Arm.RootPart.CFrame
		local goal = {CFrame = frame * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.rad( math.random(-50,50)))} --Moves up or down depending on the beat of the Sound
		local Right = {CFrame = Arm * CFrame.fromAxisAngle(Vector3.new(1,0,0),math.rad(math.random(-50,50)))} --Suppsed to move Left or Right depending on the Beat of the sound
		tween:Create(children[i].Head.Head,TweenInfo.new(0 - (2 - 0) * Sound.PlaybackLoudness/150),goal):Play()
		tween:Create(children[i].Head.Part,TweenInfo.new(0 - (2 - 0) * Sound.PlaybackLoudness/150),{Color = color}):Play()
		tween:Create(children[i].Head.Part.SpotLight,TweenInfo.new(0 - (2 - 0) * Sound.PlaybackLoudness/150),{Color = color}):Play()
		tween:Create(children[i].Arm.RootPart,TweenInfo.new(1 * Sound.PlaybackLoudness/150),Right):Play()
		children[i].Head.Part.light.Color = ColorSequence.new(color)
	end
end
1 Like

I’m not too familiar with this, but do you have the U shaped section as a Model?
If you do you should set the Model’s PrimaryPart to one of the Parts that are inline with the X,Y,Z axes.

That’s what I thought too. However I’m still getting the same results