How to detect if the player was in first person?

So I want to make it that if you went into firstperson, a gui pops up.
But how do I detect if the player went to first person or not?

1 Like

you can use the property of player the cameraminimumzoomdistance detect it when its 0.5

example code

if game.Players.LocalPlayer.CameraMinimumZoomDistance <= 0.5 then
       --make frame visible
end
1 Like

You could use the Player:GetPropertyChangedSignal method to get a notification. For example if you wanted to do it based on CameraMode you could try this.

local player = game.Players.LocalPlayer

local function handleCameraModeChanged()
   if player.CameraMode == Enum.CameraMode.LockFirstPerson then
    -- do your stuff
  end
end

local signalConnection = player:GetPropertyChangedSignal("CameraMode"):Connect(handleCameraModeChanged)