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

How do I detect if someone's in first person?

Asked by
3rdblox 30
10 years ago

How do I tell if a player is zoomed all the way in?

1 answer

Log in to vote
1
Answered by
Dummiez 360 Moderation Voter
10 years ago

Check the CurrentCamera Magnitude.

-- Should be in a LocalScript in the PlayerGui.
local Cam = game.Workspace.CurrentCamera 

game:GetService('RunService').Stepped:connect(function() -- Runs 1/30th of a frame. (A loop)
    if (Cam.focus.p - Cam.CoordinateFrame.p).magnitude <= 1 then 
    Print 'player is zoomed in. (Do stuff here)'
    else
    Print 'player is zoomed out.  (Do stuff here)'
    end 
end)
Ad

Answer this question