Universal Script 📌
7.1k Views
315 Executions

head movement

Universal Script 📌
Flipflop
FlipflopPublished 10
4 years ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

head mvoement

View Raw
local Camera = workspace.CurrentCamera
local Player = game.Players.LocalPlayer

local Character = Player.Character
local Root = Character:WaitForChild("HumanoidRootPart")
local Neck = Character:FindFirstChild("Neck", true)
local YOffset = Neck.C0.Y

local CFNew, CFAng = CFrame.new, CFrame.Angles
local asin = math.asin

game:GetService("RunService").RenderStepped:Connect(function()
    local CameraDirection = Root.CFrame:toObjectSpace(Camera.CFrame).lookVector
    if Neck then
		if Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
        	Neck.C0 = CFNew(0, YOffset, 0) * CFAng(0, -asin(CameraDirection.x), 0) * CFAng(asin(CameraDirection.y), 0, 0)
		elseif Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
			Neck.C0 = CFNew(0, YOffset, 0) * CFAng(3 * math.pi/2, 0, math.pi) * CFAng(0, 0, -asin(CameraDirection.x)) * CFAng(-asin(CameraDirection.y), 0, 0)
		end
    end
end)


Comments

1
Log in to join the conversation. Login
piska*213's profile picture
piska*2132 years ago(edited)

FE?

1

More universal scripts

See all
Script hub
425.5k
815.6k
Bumped 34 minutes ago
Key System

Script hub

Hall of Fame #5

Verified script badgeRonix Hub | 71 Supported Games + OP!

Script hub
3.0M
387.8k
Bumped 34 minutes ago
Key System

Script hub

Hall of Fame #8

Verified script badgeOverflow #1 SAE, MM2 & More

Universal Script 📌
51
1
Approved 37 minutes ago
Universal Script 📌
162.3k
51.2k
Bumped 1 hour ago