If you want your avatar to not be blocking the camera, try this:
local Character = game.Players.LocalPlayer.Character
local Head = Character.Head
local Camera = workspace.CurrentCamera
Camera.CameraSubject = Head
local OldProperties = {} -- Holds the last properties so they can be properly reverted
local function ShowParts(Hide)
for _, Object in pairs(Character:GetDescendants()) do
if Object:IsA("BasePart") then
-- Hide/show all parts
if Hide then OldProperties[Object:GetFullName()] = Object.Transparency end
Object.Transparency = Hide and 1 or OldProperties[Object:GetFullName()]
elseif Object.ClassName == "ParticleEmitter" then
-- Might also want to hide particles
if Hide then OldProperties[Object:GetFullName()] = Object.Size end
Object.Size = Hide and NumberSequence.new(0) or OldProperties[Object:GetFullName()]
end
end
end
local Hidden = false -- Whether the character is hidden
Camera:GetPropertyChangedSignal("CFrame"):Connect(function() -- Whenever the camera moves
local cf = Camera.CFrame -- Current position
local focus = Camera.Focus -- Where exactly the camera is trying to focus on (your head)
-- Get the distance from the camera to your head
local Distance = math.abs(cf.X - focus.X) + math.abs(cf.Y - focus.Y) + math.abs(cf.Z - focus.Z)
if Distance < 1 then -- most likely first person if true
if Hidden then return end
Hidden = true
ShowParts(true)
else
if not Hidden then return end
Hidden = false
ShowParts(false)
end
end)