Use a cylindrical constraint, it will make your life easier as you can just use your mouse to set the pivot point while adjusting the speed and direction in a script and the angles and other stuff in the properties on the constraint.
you dont have to use while true do bc you can make tween Reverses
local tweenInfo = TweenInfo.new(
2, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
-1, -- RepeatCount (when less than zero the tween will loop indefinitely)
true, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local tweenService = game:GetService("TweenService")
local model = script.Parent
local head = model.Head
local part = head.PrimaryPart
local tween
while true do
tween = tweenService:Create(part, TweenInfo.new(7), {CFrame = part.CFrame * CFrame.Angles(math.rad(45), 0, 0)})
tween:Play()
tween.Completed:Wait()
tween = tweenService:Create(part, TweenInfo.new(7), {CFrame = part.CFrame * CFrame.Angles(math.rad(-90), 0, 0)})
tween:Play()
tween.Completed:Wait()
end