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:
I would like that after pressing the E key the complete player is seen:
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)
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
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