CameraType first person view problem

So, I made this thing where when you touch a part, you would be greeted a CFrame camera view. For example:

But when I go in first person and enter the lift, it would look like this:

So can you give me ideas on how to make the player visible when the player is on first person? I want the game to be compatible with phone and PC. No errors or anything got printed, so I would hope this is going to be a possible task.

2 Likes

This is a client thing.
You go first person and all (AND I MEAN ALL) of the things go invisible that is in the character model.
Well except tools.
You can write a check for that so… idk… have it turn the transparency of the player to 0 when it touches it.

(if i have something i will reply more)

2 Likes

When you go first person, your body parts will be invisible. To counteract that in the lift, just set their LocalTransparencyModifier in a RenderStepped event:

for _,v in pairs(character:GetDescendants()) do
    if v:IsA("BaseLart") and v.Name ~= "HumanoidRootPart" then
         v.LocalTransparencyModifier = 0
    end
end
1 Like

Wait… Should this be in a local script or a normal script?

A local script in StarterPlayer Scripts

local RunService = game:GetService("RunService");
local Player = game.Players.LocalPlayer;
local Character = Player.Character or Player.CharacterAdded:Wait();
local Camera = game.Workspace.CurrentCamera;
local Head = Character:WaitForChild("Head");

local FPMaximumDistance = 0.6; -- For scalability, but keep it at 0.6 since it is the right distance.
local FirstPersonLocalTransparency = 0;
local ThirdPresonLocalTransparency = 0;

local function SetCharacterLocalTransparency(transparency)
    for i,v in pairs(Character:GetChildren()) do
       if (v:IsA("BasePart")) and not (v.Name == "UpperTorso") and not (v.Name == "Head") then -- Only baseparts have a LocalTransparencyModifier property.
          v.LocalTransparencyModifier = transparency;
       end
    end
end

RunService.RenderStepped:Connect(function()
   local isfirstperson = (Head.CFrame.Position - Camera.CFrame.Position).Magnitude < FPMaximumDistance; -- Determine wether we are in first person
   if (isfirstperson) then
      SetCharacterLocalTransparency(FirstPersonLocalTransparency);
   else
      SetCharacterLocalTransparency(ThirdPresonLocalTransparency);
   end
end)


1 Like

It should be in a local script, hence the name LocalTransparencyModifier