Cursor position not accurate

Hello,
I’m trying to replace the current game cursor with custom made on. (i’m using the method of finding the position cause i’m planning on making the cursor change color on game on, so i can’t just change the icon)

I’m having problems tho. The position isn’t accurate and i can clearly see the mouse image that should replace it a little upper.
Script:

--Servizi
local UIS = game:GetService("UserInputService");
local Giocatori = game:GetService("Players"); 

--Variabili
local Giocatore = Giocatori.LocalPlayer; --player
local mouse = Giocatore:GetMouse(); -- mouse
local Color = script.Parent.Color
local Outline = script.Parent.Outline


--Inizio
UIS.MouseIconEnabled = true; -- disables the mouse icon (makes the mouse 'invisible')

mouse.Move:Connect(function() -- fires when the mouse moves

	Color.Position = UDim2.new(0,mouse.X,0,mouse.y);
	Outline.Position = UDim2.new(0, mouse.X, 0, mouse.Y);
end)

Thank you all a lot!

Since the offset seems to be vertical, I believe the issue is just due to GUI inset.

Or GUI service :GetGuiInset function:

3 Likes

Thank you a lot man. You saved me ahhaha

1 Like

You can also enable the IgnoreGuiInset property on the ScreenGui so that it covers the entire screen including the TopBar.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.