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

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

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.

1 answer

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)

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