How to stop player movement, and change camera mode

i have a main menu and the game is first person so i want it to lock the player and change the players camera mode from classic to lock first person and after they click start it allows player movement, how do i do that?

My code:

local PlayButton = script.Parent.PlayButton

local UpdateLogButton = script.parent.UpdateLogButton

local QuitGameButton = script.Parent.QuitGameButton

local MainFrame = script.Parent

local ChangeLogFrame = script.Parent.Parent.ChangeLog

local ChangeLogButton = script.Parent.UpdateLogButton

PlayButton.MouseButton1Click:Connect(function()

MainFrame.Visible = false

end)

UpdateLogButton.MouseButton1Click:Connect(function()

ChangeLogFrame.Visible = true

end)

QuitGameButton.MouseButton1Click:Connect(function()

game.Players.LocalPlayer:Kick(“Come back later!”)

end)

To stop player movement, you can do

--In a local script
local player = game.Players.LocalPlayer

player.Character.Humanoid.WalkSpeed = 0 -- set walk speed to 0, they can't move
player.Character.Humanoid.JumpPower = 0 -- set jump power to 0, they can't jump

and the opposite for allowing movement. To change camera, you can do

local player = game.Players.LocalPlayer -- Your character

player.CameraMode = Enum.CameraMode.LockFirstPerson -- Force First Person

You just have to call this when they press play (inside a local script). Feel free to mess with those snippets, they should do what you want them to.

Reference Articles:

2 Likes