Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I made a script that makes the head looks at mouse, but it doesn't work for r15? [closed]

Asked by 5 years ago
Edited 5 years ago

[NOTE:THIS IS A DUPLICATE OF MY LAST QUESTION BECAUSE I DIDN'T GET ANY AWNSERS ON THE LAST QUESTION]

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! Edit:oof i forgot the script

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 direction = plr:GetMouse().UnitRay.Direction
    local adjacent = math.sqrt((direction.X^2)+(direction.Z^2))
    local opp = direction.Y
    local angle = math.atan2(opp, adjacent)
    neck.C0 = CFrame.new(0,1,0)*CFrame.Angles(angle+(math.pi/2),math.pi,0)
end

Marked as Duplicate by DeceptiveCaster

This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.

Why was this question closed?