Helping with head and attachment rotation tweening

So to make this work what you should do is adjust the C0 property for a Motor6D Joint called “Neck”, which is located in the head.
The new code would look like this:

local angletoTurnIn = 60 -- for example
local angleToTurnOut = 40

local neckjoint = script.Parent.Head.Neck

local tweenservice = game:GetService("TweenService")
local thisinfo = TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)


local tweenIn = tweenservice:Create(neckjoint, thisinfo, {
    C0 = neckjoint.C0 * CFrame.Angles(0, math.rad(angleToTurnIn), 0)
}) 
local tweenOut = tweenservice:Create(neckjoint, thisinfo, {
    C0 = neckjoint.C0 * CFrame.Angles(0, math.rad(angleToTurnOut), 0)
})

local thisRand = Random.new() -- because we dont have to create a new random object every time we find a random number
while true do
	tweenIn:Play()
	wait(thisRand:NextNumber(0.8, 1.2))
	tweenOut:Play()
	wait(thisRand:NextNumber(0.8, 1.2))
end

How would I change the 60 and 40 values to be what I want them to be? Would I have to copy a value inside the head?

Very confused.

thanks for the response it was really late where I live so I decided to go to bed

Yeah, don’t use orientation, it’s very unreliable, I’d recommend using what he’s using.

No, you’d just change the angle and wrap in a math.rad.

local neckjoint = script.Parent.Head.Neck

local tweenservice = game:GetService("TweenService")
local thisinfo = TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)


local tweenIn = tweenservice:Create(neckjoint, thisinfo, {
    C0 = neckjoint.C0 * CFrame.Angles(math.rad(0.48), math.rad(27.14), math.rad(-2.41))
}) 
local tweenOut = tweenservice:Create(neckjoint, thisinfo, {
    C0 = neckjoint.C0 * CFrame.Angles(math.rad(-0.48), math.rad(-27.14), math.rad(2.41))
})

local thisRand = Random.new() -- because we dont have to create a new random object every time we find a random number
while true do
	tweenIn:Play()
	wait(thisRand:NextNumber(0.8, 1.2))
	tweenOut:Play()
	wait(thisRand:NextNumber(0.8, 1.2))
end

To explain why, CFrame.Angles uses a different thing called Radians, and to convert Degrees (what your used to using) into Radians, you would use the math.rad function.

Don’t let the vocabulary intimidate you, it’s actually super easy to convert into, which is just the math.rad function. (rad is short for radians)

1 Like

So is this the completed script?

Yeah, it’s the completed script.

1 Like

Hmm didn’t work. Any suggestions?

@Moonvane maybe you can help? I am very confused with this topic.

what is not working?
If you describe the problem, i’ll be able to help you

Everything. The head doesn’t rotate, nor the head hats/attachments with it.