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)