Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I go about Forcing First Person view?

Asked by 9 years ago

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)
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] TheeDeathCaster 2368 — 9y
0
Same effect. After pressing "q" to unzoom, it still brings me back to third person. broetchen 0 — 9y

3 answers

Log in to vote
0
Answered by 9 years ago

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

Ad
Log in to vote
0
Answered by
RedCombee 585 Moderation Voter
9 years ago
Cam.CameraMode = "LockFirstPerson"

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

0
I've done that, but it doesn't work. After pressing "q" to unzoom, it still brings me back to third person. broetchen 0 — 9y
Log in to vote
0
Answered by 9 years ago

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

Answer this question