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
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)