Hey! Im making a gun, how do you lock mouse position?
by using MouseBehavior UserInputService | Roblox Creator Documentation
local RunService = game:GetService("RunService") local UserInputService = game:GetService("UserInputService") RunService.RenderStepped:Connect(function() UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter end)
Alongside, if you’re using a custom cross-hair, consider using Mouse.Icon. Besides, if it’s set-up differently (such as in a frame), or don’t want a cursor at all, you’re able to disable it using UserInputService.MouseIconEnabled
I think that was not what he reffered to. What he meant was if it’s possible to lock the UDim2 of a mouse on an UDim2 position.
You cant force the players mouse into a position for obvious security reasons. You can lock its current position by setting its mouse behavior like @MrchipsMa said.