Problem regarding local player CFrame

Hello developers!

I have been creating an eerie game and have run into a problem. A pretty major one. My local player’s camera isn’t showing the player’s body when it’s set to a camera! In simpler words, I have a camera that simply just watches the hallway that the player is in. The hallway has toxins that make the player unconcious and then it cuts to a view of that camera in the hallway, and I want the player to be shown in it.

The problem? My game is first person, and in first person the body is not shown. I have experimented with various body transparency altering techniques but it interferes with my viewmodel arms script, for the first person view.

My solution and the help needed: I am trying to zoom out the player’s camera manually and it just doesn’t work. I used this topic Any way to make the camera zoom out and zoom in with script?

How would I fix this?

Any help is appreciated,
OceanTubez

What you can do to zoom out the camera, is first make sure LockedInFirstPerson is set to false in the StarterPlayer in Studio.

When a player join set their max distance to 0 so that they have to be zoomed in.

game.Players.PlayerAdded:Connect(function(player)
    player.CameraMaxZoomDistance = 0
    player.CameraMinZoomDistance = 0
end)

Then on the client or whatever when you need to zoom out the camera, just play around with the distance.

local function ZoomOutCamera()
   player.CameraMaxZoomDistance = 6
   player.CameraMinZoomDistance = 6
end

Maybe you’d have to override zooming out in the first place, so you can just use GetPropertyChanged on the client and set it back to zero.

Here’s a video of the problem:

also roblox 10MB video limit? how bad are we in server storage…

I have this section in my script; do you think this will work?

game.Players.LocalPlayer.CameraMaxZoomDistance = 30
game.Players.LocalPlayer.CameraMinZoomDistance = 30

Just checked- Did not work. It still shows only my arms as shown in the video.

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera

wait(5)

if character then

camera.CameraType = Enum.CameraType.Scriptable

for _, part in pairs(character:GetChildren()) do
if part:IsA(“BasePart”) then
part.LocalTransparencyModifier = 0 – this makes player visible on any view
end
end
end

This works for the body parts; but what about the accessories?

I also changed the code up a bit, to account for the head and what i THOUGHT would be accessories:

for _, part in pairs(game.Players.LocalPlayer.Character:GetChildren()) do
		
		if part:IsA("MeshPart") or part:IsA("SpecialMesh") or part:IsA("BasePart") or part.Name == "Head" or part:IsA("Accessory") then
			
			print(part.Name)
			
			part.LocalTransparencyModifier = 0
			
		end
			
	end

it worked; it found the accessory and tried to change it’s transparency modifier but, it errored and say there isn’t one. What is the thing to change for the accessories then?

1 Like
wait(1)

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera

if character then

	camera.CameraType = Enum.CameraType.Scriptable

	for _, part in pairs(character:GetChildren()) do
		if part:IsA("BasePart") then
			part.LocalTransparencyModifier = 0
		elseif part:IsA("Accessory") then
			part.Handle.LocalTransparencyModifier = 0
		end
	end
end

Thank you! Really appreciate your help.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.