It catches the head
Key RequiredUniversal

It catches the head

Universal ScriptvobBoxvobBox 1.9K views 30 executesUpdated May 2, 2025
5.0/ 5(1 votes)
10100% Positive
Lua Script•137 lines (4762 chars)
--[[ Head/Waist Follow Mouse/Camera Script with Camera Tilt Effect + Handles Player Death Gracefully + Run Shake ]]

wait()

--[Pre-Funcs]:
local Ang = CFrame.Angles
local aSin = math.asin
local aTan = math.atan

--[Constants]:
local Cam = workspace.CurrentCamera
local Plr = game.Players.LocalPlayer
local Mouse = Plr:GetMouse()

--[Character Setup Function]:
local function Setup()
	local Body = Plr.Character or Plr.CharacterAdded:Wait()
	local Head = Body:WaitForChild("Head")
	local Hum = Body:WaitForChild("Humanoid")
	local Core = Body:WaitForChild("HumanoidRootPart")
	local IsR6 = Hum.RigType.Value == 0
	local Trso = IsR6 and Body:WaitForChild("Torso") or Body:WaitForChild("UpperTorso")
	local Neck = IsR6 and Trso:WaitForChild("Neck") or Head:WaitForChild("Neck")
	local Waist = not IsR6 and Trso:FindFirstChild("Waist")

	return {
		Body = Body, Head = Head, Hum = Hum, Core = Core,
		IsR6 = IsR6, Trso = Trso, Neck = Neck, Waist = Waist,
		NeckOrgnC0 = Neck.C0,
		WaistOrgnC0 = Waist and Waist.C0
	}
end

--[Rebind on Respawn]:
local characterData = Setup()

local function RebindOnCharacterAdded()
	Plr.CharacterAdded:Connect(function(char)
		char:WaitForChild("Humanoid").Died:Connect(function()
			characterData = nil
		end)
		characterData = Setup()
	end)
end

RebindOnCharacterAdded()

--[Settings]:
local MseGuide = false
local TurnCharacterToMouse = false
local HeadHorFactor = 0.5
local HeadVertFactor = 0.5
local BodyHorFactor = 0.5
local BodyVertFactor = 0.5
local UpdateSpeed = 0.5
local cameraShakeEnabled = false
local cameraTiltAmount = 8
local currentTilt = 0

--[Input Handling]:
game:GetService("UserInputService").InputBegan:Connect(function(input, gpe)
	if gpe then return end
	if input.KeyCode == Enum.KeyCode.T then
		cameraShakeEnabled = not cameraShakeEnabled
	end
end)

--[Render Loop]:
game:GetService("RunService").RenderStepped:Connect(function()
	local data = characterData
	if not data then return end

	local Hum = data.Hum
	local isFirstPerson = (Cam.Focus.Position - Cam.CFrame.Position).Magnitude < 1

	if Hum and Hum.Health > 0 and not isFirstPerson then
		local Head = data.Head
		local Trso = data.Trso
		local Neck = data.Neck
		local Waist = data.Waist
		local NeckOrgnC0 = data.NeckOrgnC0
		local WaistOrgnC0 = data.WaistOrgnC0
		local Core = data.Core

		if Head and Trso and Neck then
			local TrsoLV = Trso.CFrame.LookVector
			local HdPos = Head.Position
			local Dist, Diff

			if not MseGuide then
				Dist = (HdPos - Cam.CFrame.Position).Magnitude
				Diff = HdPos.Y - Cam.CFrame.Position.Y
				if not data.IsR6 and Waist and WaistOrgnC0 then
					Neck.C0 = Neck.C0:Lerp(NeckOrgnC0 * Ang((aSin(Diff/Dist) * HeadVertFactor), -((HdPos - Cam.CFrame.Position).Unit:Cross(TrsoLV)).Y * HeadHorFactor, 0), UpdateSpeed/2)
					Waist.C0 = Waist.C0:Lerp(WaistOrgnC0 * Ang((aSin(Diff/Dist) * BodyVertFactor), -((HdPos - Cam.CFrame.Position).Unit:Cross(TrsoLV)).Y * BodyHorFactor, 0), UpdateSpeed/2)
				else
					Neck.C0 = Neck.C0:Lerp(NeckOrgnC0 * Ang(-(aSin(Diff/Dist) * HeadVertFactor), 0, -((HdPos - Cam.CFrame.Position).Unit:Cross(TrsoLV)).Y * HeadHorFactor), UpdateSpeed/2)
				end
			else
				local Point = Mouse.Hit.Position
				Dist = (HdPos - Point).Magnitude
				Diff = HdPos.Y - Point.Y
				if not data.IsR6 and Waist and WaistOrgnC0 then
					Neck.C0 = Neck.C0:Lerp(NeckOrgnC0 * Ang(-(aTan(Diff/Dist) * HeadVertFactor), ((HdPos - Point).Unit:Cross(TrsoLV)).Y * HeadHorFactor, 0), UpdateSpeed/2)
					Waist.C0 = Waist.C0:Lerp(WaistOrgnC0 * Ang(-(aTan(Diff/Dist) * BodyVertFactor), ((HdPos - Point).Unit:Cross(TrsoLV)).Y * BodyHorFactor, 0), UpdateSpeed/2)
				else
					Neck.C0 = Neck.C0:Lerp(NeckOrgnC0 * Ang((aTan(Diff/Dist) * HeadVertFactor), 0, ((HdPos - Point).Unit:Cross(TrsoLV)).Y * HeadHorFactor), UpdateSpeed/2)
				end
			end
		end

		if TurnCharacterToMouse and data.Core then
			Hum.AutoRotate = false
			local lookPos = Vector3.new(Mouse.Hit.Position.X, data.Core.Position.Y, Mouse.Hit.Position.Z)
			data.Core.CFrame = data.Core.CFrame:Lerp(CFrame.new(data.Core.Position, lookPos), UpdateSpeed/2)
		else
			Hum.AutoRotate = true
		end
	end

	if data.Head then
		local headLook = data.Head.CFrame.LookVector
		local camLook = Cam.CFrame.LookVector
		local tiltInfluence = (headLook - camLook).X
		local targetTilt = cameraShakeEnabled and math.clamp(tiltInfluence * cameraTiltAmount, -cameraTiltAmount, cameraTiltAmount) or 0
		currentTilt = currentTilt + (targetTilt - currentTilt) * 0.3

		if data.Hum.MoveDirection.Magnitude > 0.1 and data.Hum.WalkSpeed > 16 then
			local runShake = math.sin(tick() * 20) * 1.5
			currentTilt = currentTilt + runShake * 0.05
		end
	else
		currentTilt = currentTilt * 0.9
	end

	Cam.CFrame = Cam.CFrame * CFrame.Angles(0, 0, math.rad(currentTilt))
end)

Features & Information

😇

Community Comments (1)

illorsmillorsmMay 2, 2025

Pretty cool :)

More Scripts for Universal Scripts