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 make a gui button force you into first person?

Basically, I'm trying to make a first person horror game for 2021 and I've tried looking around but I found nothing related to this. Basically just a text button that forces the person to be locked in first person.

2 answers

script.Parent.MouseButton1Down:Connect(function(player) --Make this pathway to your own, unless you copy my instructions on the bottom!
	game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
end)

If I misunderstood the question you can always reply back!

You'd put this in a LocalScript underneath your TextButton that should be under the ScreenGui that should be under StarterGui. So all in all, StarterGui > ScreenGui > TextButton > LocalScript

My script is quite similar to the other guy's, I'm not copying...

local gui = --your button

gui.MouseButton1Click:Connect(function()
	local player = game.Players.LocalPlayer
	player.CameraMode = Enum.CameraMode.LockFirstPerson
end)

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