Introduction
When getting the mouse position in-game, the position isn’t even close to accurate, usually two to three frames behind the actual position. When getting the position in studio, using the same methods, the position is 100% accurate.
After doing some diving into the deep dark of the devforum, I found that around 2014 there was an update made to studio that several users reported “broke” their sensitivity. There is also the HardwareMouse setting, which I couldn’t find in any menu anywhere, but appears to be an old studio setting to change mouse behavior, perhaps a beta of this mouse change?
Having an accurate mouse position at all times is incredibly important for almost any game. Even a few frames of delay is a big deal.
Reproduction
This bug can be reproduced by running the following code on the client.
local gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
local frame = Instance.new("Frame", gui)
gui.IgnoreGuiInset = true
frame.Size = UDim2.fromOffset(100, 100)
local uis = game:GetService("UserInputService")
game:GetService("RunService"):BindToRenderStep("MouseMove", 5000, function()
local mousepos = uis:GetMouseLocation()
frame.Position = UDim2.fromOffset(mousepos.X, mousepos.Y)
end)
For convenience I’ve put this into a copyable game
When running this on the Desktop Client, you will find there is a significant delay between the frame and the cursor. When running this in studio or in the windows app this delay doesn’t exist, and the frame matches the mouse’s movements.
I would get a recording to exemplify this, but something interesting happened.
OBS
Open Broadcast Software is open source screen recording software that is very popular and widely used. This is the software I used when I went to record a video of this bug, but when I enabled OBS Display Capture, the bug stopped. My mouse position matched the frame perfectly, like it does in studio.
Frame Unlocking and VSync
I fully understand “Unlocking” your FPS isn’t supported, but this does contain useful information.
Because of the nature of mouse input, I messed around with “unlocking” my FPS and Enabling and Disabling VSync (using axstin/rbxfpsunlocker and NVIDIA Control Panel). I found that my results were most ideal with a fully unlocked FPS and Disabled VSync.
System Information
Intel(R) Core™ i7-8700K CPU @ 3.70GHz
16 GB
NVIDIA GeForce RTX 2080