Custom cursor changes when hovered on ui

custom cursor changes when hovered on ui


local Mouse = game.Players.LocalPlayer:GetMouse()

Mouse.Icon = “rbxassetid://6549216050”

It’s a localscript inside ScreenGui

Not possible. Button hovering forcefully overrides the icon to default, been like this for years.

What you can do, is disable the mouse icon entirely, and replacing it with an ImageLabel that follows the invisible mouse.


local Player = game:GetService(“Players”).LocalPlayer
local UIS = game:GetService("UserInputService")

UIS.MouseIconEnabled = false -- This disables the mouse icon, rendering it invisible

local OFFSET_X = -40
local OFFSET_Y = -40

--[[
Create am ImageLabel in StarterGUI,
with a very high ZIndex or DisplayOrder,
and index it below
]]--

local MouseIcon = “INDEX LABEL HERE”

---------------------------------

local Mouse = Player:GetMouse()

Mouse.Move:Connect(function() -- New image will follow mouse
    MouseIcon.Position = UDim2.new(0, Mouse.X - OFFSET_X, 0, Mouse.Y - OFFSET_Y)
end)
2 Likes

It is impossible to stop the cursor image from changing when hovering over UI elements, but there are a couple ways to fix this.

  1. Constantly change the mouse icon whenever it hovers over something using the MouseEnter and MouseLeave functions.

  2. Removing the default cursor icon and having an ImageLabel with your custom icon follow where the mouse would be (like YawnMcie’s post above).