I wrote this script:
local player = game.Players.LocalPlayer local character = player.character local head = character.Head local uppertorso = character.UpperTorso local lowertorso = character.LowerTorso local camera = game.Workspace.CurrentCamera local uis = game:GetService("UserInputService") local rs = game:GetService("RunService") function headMove() local camangle = camera.CFrame.lookVector character.UpperTorso.Neck.C0 = CFrame.new(Vector3.new(0,1,0), Vector3.new(camangle.x,camangle.y,camangle.z)) end rs.Stepped:Connect(headMove)
and it won't Translate correctly, like the head is on a weird rotation and everything, all of the movements of the camera translate to the right type of rotation to the Neck, but the position is off... Any help will be greatly appreciated.
_____ ,-' `._ ,' `. ,-. ,' \ ),.\ ,. / \ /( \; /'\\ ,o. ,ooooo. \ ,' `-') )) )`. d8P"Y8. ,8P"""""Y8. `' .--"' (`-' `Y' `Y8 dP `' / `----.( __ ` ,' ,---. ( ),--.`. ( ;,---. ) / \O_,' ) \ \O_,' | ; `-- ,' `---' | | -' `. | _; , ) : _.'| `.:._ ,.::" `.. | --' | .' """ ` |`. | :; : : _. |`.`.-'--. | ' . : :__.,'|/ | \ ` \--.__.-'|_|_|-/ / ) \ \_ `--^"__,' , | ; ` `--^---' ,' | \ ` / / \ ` _ _ / \ ` / \ ' ,' `. , _,' `-.___.---'
Hi Jo_Bat,
What you're trying to accomplish is quite simple. You're just making it too complicated. You don't need to go and get each axis and set that as the look at, you can just set the Vector3 of the angle itself. Also, the position is messed up because you changed the position to be Vector3.new(0, 1, 0)
. You want to keep this position the same, so this is how you would do this whole thing.
local players = game:GetService("Players"); players.PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) local head = char:WaitForChild("Head"); local neck = head:WaitForChild("Neck"); local mouse = plr:GetMouse(); local camera = workspace:WaitForChild("Camera"); while wait() do local look_at = camera.CFrame.lookVector; neck.C0 = CFrame.new(neck.C0.p, look_at); -- Makes the Position the Neck's current position and makes the look at the position the camera is pointing to. end end) end)
Thanks,
Best regards,
~~ KingLoneCat