FirstPerson script locks mouse

put this localscript in starterplayerscripts

local gui = Instance.new("ScreenGui")
local button = Instance.new("TextButton")
button.Transparency = 1
button.Size = Udim2.new(0, 0, 0, 0)
button.Modal = true
button.Parent = gui
gui.Parent = game.Players.LocalPlayer.PlayerGui

is there a way to unlock the mouse as it is stuck in the centre of the screen when in first person. I am try to achieve is having a first person system, but issue is the mouse stops working and won’t move and will stay in the centre of the screen.

this didn’t do anything when i tried it.

try using my script i think that would work

1 Like

I tried this, but it didn’t make me go into first person at all.

Also there were no errors in output.

I’m on my phone today so I won’t be much help.

I’ve been googling your problem and I found a post that might help you:

2 Likes

oh idk if you can do that if you zoom in yourself you also cant move your mouse

1 Like

I noticed that. That is why I was wondering if there was a way to fix that.

i think its a Roblox problem maybe try searching the toolbox for a working script if no one can help you

1 Like

How is this a Roblox problem?

The mouse is force-locked if you’re in first person, this is obviously intentional.

I will try this right now Thanks!!

ive updated my script use that

local gui = Instance.new("ScreenGui")
local button = Instance.new("TextButton")
button.Transparency = 1
button.Size = Udim2.new(0, 0, 0, 0)
button.Modal = true
button.Parent = gui
gui.Parent = game.Players.LocalPlayer.PlayerGui
1 Like

Just be careful of viruses. Look for things like require(), getfenv(), setfenv() or very strange strings that look like: "48/92/72/17/05/59".

1 Like

Aren’t you meant to parent it in player.PlayerGui?

my mistake, that was an accident lol

maybe this script works
btw this is the full script replace it

local UserInputService = game:GetService(“UserInputService”)
local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer

– Lock the camera to first person
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 0, -5) – Adjust the offset as needed

– Store the initial mouse position
local initialMousePosition = UserInputService:GetMouseLocation()

– Function to update camera rotation based on mouse movement
local function UpdateCameraRotation()
local currentMousePosition = UserInputService:GetMouseLocation()
local deltaMouse = currentMousePosition - initialMousePosition

local rotationY = deltaMouse.X / 100 -- Adjust the sensitivity as needed
local rotationX = deltaMouse.Y / 100

local currentRotation = camera.CFrame:ToEulerAnglesYXZ()
local newYRotation = currentRotation.Y + rotationY
local newXRotation = math.clamp(currentRotation.X - rotationX, -math.pi/2, math.pi/2)

camera.CFrame = CFrame.new(camera.CFrame.Position) * CFrame.Angles(0, newYRotation, 0) * CFrame.Angles(newXRotation, 0, 0)
initialMousePosition = currentMousePosition

end

– Connect the function to the mouse movement event
UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
UpdateCameraRotation()
end
end)

and it didnt get the full script

@Playfullgamer_YT @DiamondDrencher1 @remcodesremcodes
Thank you for all your help!!

np man i want to help as much people as i can

1 Like

to get the whole script, you have to wrap your text around three backquotes (`)

--[[
a```
code here
a```
]]

just uh, dont put the two a’s