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

How do I keep mouse centered?

I'm trying to keep my mouse centered on the screen so I can make a third person view in my game. This doesn't work but yeah :P

mouse.Changed:connect(function()
mouse.Y = 0
mouse.X = 0
end)

2 answers

✓ Accepted answer

You can use UserInputService to do this:

game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter

There's actually a built-in way to get the players mouse, you'd need to make a local script and put it in StarterPack or StarterGui :

local Player = script.Parent.Parent
local mouse = Player:GetMouse()

function CenteredMouse()
-- Code
end

-- Call the function

1 comment

0

I've already got the Player and Mouse thing done

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