local O=game:GetService("\080\108\097\121\101\114\115")local V=game:GetService("\082\117\110\083\101\114\118\105\099\101")local b=Vector3.new()local i=O.LocalPlayer function Update()local O=i.Character local V=workspace.CurrentCamera if not O then return end local I=O:WaitForChild("\072\117\109\097\110\111\105\100")local u=O:WaitForChild("\072\117\109\097\110\111\105\100\082\111\111\116\080\097\114\116")local r=O:WaitForChild("\072\101\097\100")for O,V in ipairs(O:GetChildren())do if V:IsA("\066\097\115\101\080\097\114\116")then if V.Name~="\072\101\097\100"then V.LocalTransparencyModifier=0 end elseif V:IsA("\065\099\099\111\117\116\114\101\109\101\110\116")then local O=V:FindFirstChild("\072\097\110\100\108\101")if O then local V=(O:FindFirstChild("\072\097\116\065\116\116\097\099\104\109\101\110\116")or O:FindFirstChild("\072\097\105\114\065\116\116\097\099\104\109\101\110\116")or O:FindFirstChild("\070\097\099\101\065\116\116\097\099\104\109\101\110\116")or O:FindFirstChild("\078\101\099\107\065\116\116\097\099\104\109\101\110\116"))~=nil if V then if ViewAccessories and ViewHeadAccessories then O.LocalTransparencyModifier=0 end else if ViewAccessories then O.LocalTransparencyModifier=0 end end end end end if RealisticView and i.CameraMode==Enum.CameraMode.LockFirstPerson or(O:WaitForChild("\072\101\097\100")).LocalTransparencyModifier==1 then local i=V.CFrame local T=V.CFrame*CFrame.new(0,0,-1)local n=(i.Y-T.Y)*-1 local o=0 local M=0 local g=1.5 local a=Vector3.new(0,0,math.min(n-o,0))local v=O:FindFirstChild("\085\112\112\101\114\084\111\114\115\111")if v then local O=(u.CFrame:toObjectSpace(r.CFrame)).p b=a+(O-Vector3.new(0,2,0))else b=a end I.CameraOffset=b else I.CameraOffset=Vector3.new()end end if AutoLockFirstPerson then i.CameraMode=Enum.CameraMode.LockFirstPerson end V.RenderStepped:Connect(Update)
------------
--[[CODE]]
--
------------
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")

local Offset = Vector3.new()

local Player = Players.LocalPlayer

function Update()
	local Character = Player.Character --I'll have this here, should the script be in StarterPlayerScripts
	local Camera = workspace.CurrentCamera --In case they delete the camera or something.
	if not Character then
		return
	end

	local Humanoid = Character:WaitForChild("Humanoid")
	local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
	local Head = Character:WaitForChild("Head")

	for Index, Item in ipairs(Character:GetChildren()) do
		if Item:IsA("BasePart") then
			if Item.Name ~= "Head" then
				Item.LocalTransparencyModifier = 0
			end
		elseif Item:IsA("Accoutrement") then
			local Handle = Item:FindFirstChild("Handle")
			if Handle then
				local ConnectedToHead = (
					Handle:FindFirstChild("HatAttachment")
					or Handle:FindFirstChild("HairAttachment")
					or Handle:FindFirstChild("FaceAttachment")
					or Handle:FindFirstChild("NeckAttachment")
				) ~= nil
				if ConnectedToHead then
					if ViewAccessories and ViewHeadAccessories then
						Handle.LocalTransparencyModifier = 0
					end
				else
					if ViewAccessories then
						Handle.LocalTransparencyModifier = 0
					end
				end
			end
		end
	end

	if
		(RealisticView and Player.CameraMode == Enum.CameraMode.LockFirstPerson)
		or (Character:WaitForChild("Head").LocalTransparencyModifier == 1)
	then
		--Above: Adding [or (Character:WaitForChild("Head").LocalTransparencyModifier == 1)] will make it so we can
		--detect if the player is in first-person
		local Origin = Camera.CFrame
		local Out = Camera.CFrame * CFrame.new(0, 0, -1)
		local Y_Diff = (Origin.Y - Out.Y) * -1
		local Z_Diff = 0
		local Extra_X = 0
		local Extra_Y = 1.5

		local Camera_Offset = Vector3.new(0, 0, math.min(Y_Diff - Z_Diff, 0))

		--Update #2: R15 offsets cause issues with this code block. This next one will fix that.
		local UpperTorso = Character:FindFirstChild("UpperTorso")
		if UpperTorso then
			local OffsetVal = HumanoidRootPart.CFrame:toObjectSpace(Head.CFrame).p
			Offset = Camera_Offset + (OffsetVal - Vector3.new(0, 2, 0))
		else
			Offset = Camera_Offset
		end

		Humanoid.CameraOffset = Offset
	else
		Humanoid.CameraOffset = Vector3.new()
	end
end

if AutoLockFirstPerson then
	Player.CameraMode = Enum.CameraMode.LockFirstPerson
end

RunService.RenderStepped:Connect(Update)
