Camera view field issues help

Hello! In my learning game the game starts in the first person, as seen in the first image below, but I would like that after pressing E (I already have this programmed) the view is changed and the entire player is seen on the screen, How can I do that? as in the second picture

FPS VIEW:
image

I would like that after pressing the E key the complete player is seen:

image

localscript:

local uis = game:GetService("UserInputService")
local runService = game:GetService('RunService')

local camera = workspace.CurrentCamera

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local humanoid = char:WaitForChild("Humanoid")

local isActive = false

player.CameraMode = Enum.CameraMode.LockFirstPerson
player.Character.Humanoid.CameraOffset = Vector3.new(0, -0.4, -0.2)

uis.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E and isActive == false then
		player.CameraMode = Enum.CameraMode.Classic
		print('Classic Mode')
		isActive = true
	elseif input.KeyCode == Enum.KeyCode.E and isActive == true then
		player.CameraMode = Enum.CameraMode.LockFirstPerson
		player.Character.Humanoid.CameraOffset = Vector3.new(0, -0.4, -0.2)
		print('LockFirstPerson Mode')
		isActive = false
	end
end)
1 Like

Try running the if input statement once and then checking if isActive equals true or false.

local uis = game:GetService("UserInputService")
local runService = game:GetService('RunService')

local camera = workspace.CurrentCamera

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local humanoid = char:WaitForChild("Humanoid")

local isActive = false

player.CameraMode = Enum.CameraMode.LockFirstPerson
player.Character.Humanoid.CameraOffset = Vector3.new(0, -0.4, -0.2)

uis.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
        if isActive == true then
            player.CameraMode = Enum.CameraMode.LockFirstPerson
            player.Character.Humanoid.CameraOffset = Vector3.new(0, -0.4, -0.2)
            print("LockFirstPerson Mode")
            isActive = false
        elseif isActive == false then
            player.CameraMode = Enum.CameraMode.Classic
            print("Classic Mode")
            isActive = true
        end
	end
end)

What I mean is, when I start the game I am in first person and pressing the key again sets third person, but the visual of the camera does not change to third person, how can I do that?

I just want to make the entire player show as third person

When I press the key, the player’s visual is still in the first person (although it is set to change) but I want the visual field to be third person when i press the key

I see!

If you want, try setting the player’s CameraMinZoomDistance to something like 10 after setting its mode to classic so that the camera will be forced to zoom out, then set it back to whatever you wanted it to be before.

-- Note: This is just a standalone function, you can play with the stuff inside it how you like; this is simply here as a guide
local player = game.Players.LocalPlayer

function ZoomOut()
    player.CameraMode = Enum.CameraMode.Classic
    player.CameraMinZoomDistance = 10 -- What it should do here is force the player's camera to zoom out since the min zoom distance has been changed.
    player.CameraMaxZoomDistance = 11 -- this is simply to make sure that the max distance is higher than the min distance so the script can function properly
    task.wait()
    player.CameraMinZoomDistance = YourValue -- Change this back to the value you want your regular minimum zoom distance to be when the player is in third person
    player.CameraMaxZoomDistance = YourValue -- Change this back to the value you want your regular maximum zoom distance to be when the player is in third person
end
1 Like

Thank you very much that was what I was looking for!

by the way I can ask you something, by any chance do you know how I can remove this limit?

robloxapp-20211021-1830140.wmv (794,5 KB)

when I try to move the camera up there is like a barrier, a limit

1 Like

In order to stay on topic and comply with forum TOS, you’ll have to create a new topic if you haven’t already and I can answer it there!

1 Like

It’s fine! Thank you very much for your help :smiley:

1 Like