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.
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.
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
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)