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

How can I put a players camera in first person when the player clicked play? [closed]

Asked by 8 years ago

I have tried many scripts on this site but there wasent any for when the player clicks a gui. Or I just dint see one. Please help.

Locked by User#19524

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
8 years ago

Each player has a property named CameraMode which holds an enum, either Classic or LockFirstPerson.

You can use the MouseButton1Click event of a GuiButton in order to toggle or set the CameraMode when the player clicks on the Gui.

In A Local Script:

local player = game.Players.LocalPlayer
local gui = GUI_BUTTON

gui.MouseButton1Click:connect(function()
    if player.CameraMode == Enum.CameraMode.Classic then
        player.CameraMode = Enum.CameraMode.LockFirstPerson
    else
        player.CameraMode = Enum.CameraMode.Classic
    end
end)
Ad