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

How do I create a Head Turn script?

Asked by 10 years ago

Hello SH, recently I've been trying to create a script where your head would turn to where ever your camera's position was since all the free modeled scripts are now broken because of ROBLOX's animations update. I would like some help on how to create this script. Here's the old broken code if you need it:

repeat wait() until game.Players.LocalPlayer.Character 

game.Players.LocalPlayer.Character.Torso.Neck.MaxVelocity = 0.3

function turnheads()
    while true do
        wait()
        if game.Players.LocalPlayer.Character then
            if game.Workspace.CurrentCamera.CameraSubject == game.Players.LocalPlayer.Character:FindFirstChild("Humanoid") then
                camf = Vector3.new(game.Workspace.CurrentCamera.CoordinateFrame.X,game.Workspace.CurrentCamera.CoordinateFrame.Y,game.Workspace.CurrentCamera.CoordinateFrame.Z)    
                lv = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector
                torsop = game.Players.LocalPlayer.Character.Head.Position
                game.Players.LocalPlayer.Character.Torso.Neck.DesiredAngle = -(((torsop - camf).Unit):Cross(lv)).Y
            end
        end
    end
end

turnheads()
0
If that script was to be run inside of a tool and was a script, make it a localscript and see what happens. XanthicDragon 38 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

hmm try this

for X = 1, math.huge, 0.1 do wait() game.Workspace.LocalPlayer.Torso.Neck.C0 = CFrame.new(0,1.5,0) * CFrame.fromAxisAngle(Vector3.new(0,1,0), X) game.Workspace.LocalPlayer.Torso.Neck.C1 = CFrame.new(0,0,0) end

Ad

Answer this question