When reverting current camera type back to custom, avatar accessories and hats don't go invisible

What is the issue?

The issue is when reverting the current camera from CameraType.Scriptable to CameraType.Custom, first person accessories don’t get removed (See Example 2)

Example 1 (What it should look like)
https://gyazo.com/02c71759f5ebd6b8dae2c4a65c80f635

Example 2 (What happens)
https://gyazo.com/bb1bcd9bd68aa44a32e7e3ef85ae39ae

Script

local Cam = game.Workspace.CurrentCamera

Cam.CameraType = Enum.CameraType.Scriptable

local cameraBlock = workspace.CameraPointAt
local cameraPos = workspace.CameraPosition

local postition = cameraPos.Position
local lookAt = cameraBlock.Position

Cam.CFrame = CFrame.new(postition,lookAt)

... --More code here

Cam.CameraType = Enum.CameraType.Custom
Cam.CameraSubject = game.Players.LocalPlayer.Character.Head

What solutions have you tried so far?
I have looked around the devforum for solutions, however I have not seen any posts like this

Any help is appreciated!

Since your CameraType is custom, the normal first person changes don’t apply. You’ll have to make accessories invisible yourself

local Cam = game.Workspace.CurrentCamera

Cam.CameraType = Enum.CameraType.Scriptable

local cameraBlock = workspace.CameraPointAt
local cameraPos = workspace.CameraPosition

local postition = cameraPos.Position
local lookAt = cameraBlock.Position

Cam.CFrame = CFrame.new(postition,lookAt)

... --More code here

Cam.CameraType = Enum.CameraType.Custom
-- Loop through accessories
for _, object in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
    if object:IsA("Accessory") and object:FindFirstChild("Handle") then
        object.Transparency = 1
    end
end

Cam.CameraSubject = game.Players.LocalPlayer.Character.Head

You’ll probably also want to make the body parts invisible

1 Like

This might interest you: Documentation - Roblox Creator Hub

Thanks for the reply, the code works, but in 3rd person your character is still invisible. I was looking to revert the camera function to the roblox default. Thank you though, sorry if I was not clear.

You can try looking through the camera scripts and see how Roblox implements the first person script

1 Like