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

Whats wrong with this script?

Asked by 10 years ago
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
Use code formatting, please, it's very hard to read like that. Click the circular Lua sign in the text editor and insert the code between the lines that it inserts. duckwit 1404 — 10y
0
Takes a lot of effort to read through that, or to run it ourselves, you could describe what is not working (such as the output) and make it more readable by replacing 'game.Players.LocalPlayer.Character' with a variable that references that object path. duckwit 1404 — 10y

Answer this question