So for my fps, I need to know how to make the character look at the mouse or make the head rotate when the character moves. I found a tutorial and made this script, it works for r6, but not for r15. Can somebody plz help me!
local plr = game.Players.LocalPlayer
local rs = game:GetService('RunService')
local char = plr.Character
repeat wait() until char
local torso = char:FindFirstChild('Torso') or char:FindFirstChild('Head')
repeat wait() until torso
local neck = torso:FindFirstChild('Neck')
local cam = game.Workspace.CurrentCamera
while rs.RenderStepped:Wait() do
local lv = plr:GetMouse().UnitRay.Direction--mistake im to lazy to edit lel(supposed to be direction for the variable name)
local adjacent = math.sqrt((lv.X^2)+(lv.Z^2))
local opp = lv.Y
local angle = math.atan2(opp, adjacent)
neck.C0 = CFrame.new(0,1,0)*CFrame.Angles(angle+(math.pi/2),math.pi,0)
end

1 comment
I putted 'or char:FindFirstChild('Head')' because the neck motor6d is in their for MOTOR6D!