Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I go about Forcing First Person view?

So I've got this scope script bound to "q" and whenever I scope in and then out, I'm back to Third-Person. Any way to avoid this?

Tool = script.Parent
Player = game.Players.LocalPlayer
Cam = game.Workspace.CurrentCamera

Tool.Unequipped:connect(function()
Cam.FieldOfView = 80
Player.CameraMode = "Classic"
if Player.PlayerGui:FindFirstChild("Scope") ~= nil then
Player.PlayerGui.Scope:Destroy()
end
end) 

zoomed = false
function ZOOM(key)
if key then
key = string.lower(key)
if (key=="q") and not zoomed then
zoomed = true
Cam.FieldOfView = 20
Player.CameraMode = "LockFirstPerson"
if Player.PlayerGui:FindFirstChild("Scope") == nil then
script.Parent.Scope:Clone().Parent = Player.PlayerGui
end
elseif key == "q" and zoomed then
zoomed = false
Cam.FieldOfView = 80
Player.CameraMode = "Classic"
if Player.PlayerGui:FindFirstChild("Scope") ~= nil then
Player.PlayerGui.Scope:Destroy()
end
end
end
end
Tool.Equipped:connect(function(mouse)
mouse.KeyDown:connect(ZOOM)
end)

2 comments

0

Have you tried doing 'Player.CameraMode = 0' or 'Player.CameraMode = 1'? Because I've noticed just doing 'Player.CameraMode = "LockFirstPerson" is a bit buggy. [0 = Classic, 1 = LockFirstPerson]

0

Same effect. After pressing "q" to unzoom, it still brings me back to third person.

3 answers

✓ Accepted answer

They have added a StarterPlayer folder to roblox, in there there is a camera option to keep you in first person, without scripts

Cam.CameraMode = "LockFirstPerson"

I'm pretty sure that's what you're looking for.

1 comment

0

I've done that, but it doesn't work. After pressing "q" to unzoom, it still brings me back to third person.

EASY local plr = game.Players.localPlayer local cam = game.workspace.CurrentCamera local chr = nil

chr = character plr.CameraMode = 1

while false do wait () cam.CameraType = 0 cam.CoordinateFrame = CFrame.new (200,10,0) cam.focus = CFrame.new (200,7,500) cam.FieldOfView = 20 end

Put it in starter GUI

This discussion is preserved as it was. New answers, comments, and votes are closed.