First person bug in my game

so, the camera in my game consists of following certain camparts, and a intvalue in the players character determines the behavior : 0 is smooth tween, 1 is instant tweening, and 2 is first person.

this works fine but whenever the value is set to 2 and the player goes in first person, when it changes to 0 or 1, the camera follows whichever campart fine but the player never actually leaves first person, so the player stays invisible and faces the other way from the camera. ive tried forcing the player to zoom out but nothings worked, would love some help!

this is the code :

local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
Camera.CameraType = "Scriptable"
Camera.CFrame = game.Workspace.CamPart.CFrame

game:GetService("RunService").RenderStepped:Connect(function()
	script.Parent.Parent.CamDefault.Enabled = false
	script.Parent.Parent.CamSnap.Enabled = false

	if script.Parent.Value == 0 or script.Parent.Value == 1 then
		Player.CameraMinZoomDistance = 12
		Player.CameraMaxZoomDistance = 12
		Camera.CameraType = Enum.CameraType.Scriptable
		Player.CameraMode = Enum.CameraMode.Classic
		Camera.CFrame = game.Workspace.CamPart.CFrame
		if script.Parent.Value == 0 then
			Player.CameraMinZoomDistance = 12
			Player.CameraMaxZoomDistance = 12
			script.Parent.Parent.CamDefault.Enabled = true
			script.Parent.Parent.CamSnap.Enabled = false
		elseif script.Parent.Value == 1 then
			Player.CameraMinZoomDistance = 12
			Player.CameraMaxZoomDistance = 12
			script.Parent.Parent.CamDefault.Enabled = false
			script.Parent.Parent.CamSnap.Enabled = true
		end
	elseif script.Parent.Value == 2 then
		
		Player.CameraMinZoomDistance = 0.5
		Player.CameraMaxZoomDistance = 0.5
		Camera.CameraType = Enum.CameraType.Custom
		Player.CameraMode = Enum.CameraMode.LockFirstPerson
		Camera.CFrame =  Player:WaitForChild("Character"):WaitForChild("Head").CFrame
	end
end)

TransparencyController never resets
When you go FP (CameraMode = LockFirstPerson), Roblox’s internal camera script sets your character’s parts’ LocalTransparencyModifier = 1 so you can’t see your own head/arms. When you flip to your Scriptable camera, the default camera script stops running its update, so it never puts those values back to 0. Result: your character stays invisible and appears to face “wrong” relative to your custom camera.

how to fix:

  • Handle mode changes once (use a .Changed on your IntValue, not every frame).
  • When switching out of 2 → (0 or 1):
  • First set CameraMode = Classic, CameraType = Custom, and CameraMin/MaxZoom to something > 0.5 for one rendered frame so the default camera script can restore LocalTransparencyModifier to 0.
  • Then switch to your Scriptable camera that follows your CamPart.
  • As a belt-and-suspenders, manually reset LocalTransparencyModifier = 0 on all BaseParts in the character after the switch.
1 Like

thank you so much!!! it worked perfectly, i feel so stupid rn hah >w<

2 Likes

Np just @ me if you need help on anything

1 Like

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