For an example in prison royale you can have your gun in third person with crosshair locked or have it in fps mode, i have tried making a script that changes camera angles but its just one big mess... ;( would anybody be able to help?
COMMUNITY QUESTION
How do script a key to press that makes my character switch from third to 1st person view?
1 answer
For this to work properly, you're going to need two things UserInputService, and MaxZoomDistance, the first Service will allow us to Fire Events to Input related scenarios, and for the property, this allows us to restric their zooming ability, giving the impression of FirstPerson
local UserInputService = game:GetService("UserInputService")
local CamView = workspace.CurrentCamera.MaxZoomDistance
local CamView2 = workspace.CurrentCamera.MinZoomDistance
local ThirdP = 500
game.Players.PlayerAdded:Connect(function() --// As Player joins
UserInputService.InputBegan:Connect(function(InputObject, GameProcessed)
if not (GameProcessed) then --// if the Key was binded to any actions event; jumping typing then ignore
if (InputObject.KeyCode == Enum.KeyCode.E) then --// KeyInput you desire
CamView, CamView2= ThirdP
end
end
end)
end)
Hope this helps! If so, don't forget to accept and upvote If there is anything confusing, please let me know!
This discussion is preserved as it was. New answers, comments, and votes are closed.

14 comments
i mean like in prison royale you can have like third person lock so your crosshair in the middle of the screen is where shoot from like in fortnite but i want to be like when i press q on my keyboard i want it to switch to first person and be able to aim down the weapon sight
Kinda like a shift lock?
yes exactly
Give me a second
and also when switched to fps mode you are able to aim down the sight/barrel and so on
Sorry, I can't do that for you
I edited the answer, it may not work, but try
okay thank you very much man for your help, contact me on discord Optix#6442 if u wanna be part of my new game for front page
If not, there is a second fix, consider referencing the LocalPlayer and then saying Player.MaxZoomDistance/min
i dont really understand any of this seems i started scripting 3 days ago
Does it work? I'll run you through on discord
yep Optix#6442
Sent
if it works then acceot the answer please;)