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

How can I make a gui button force you into first person?

Asked by 3 years ago

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

Log in to vote
0
Answered by
z_lm 9
3 years ago
Edited 3 years ago
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

Ad
Log in to vote
0
Answered by 3 years ago

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)

Answer this question