Custom Mouse Icon Script Not Working Properly

Hi! I’m trying to make a custom mouse icon for my horror game, and it works perfectly in studio, but when I join it via ROBLOX, it just displays the button icon cursor. No errors, and it works perfectly in studio, only occurs when I join my game on ROBLOX.

Here’s my code.

local uis = game:GetService("UserInputService")

uis.MouseIcon = "rbxassetid://18102237852"

(LocalScript inside StarterGui)

Images:
In Studio


In Game

(Mouse Icon didn’t show up, but its the one that appears when you hover over a GuiButton)

1 Like

press f9 and see for any errors on the client in roblox client

1 Like

No errors show up on the client

try

local UIS = game:GetService('UserInputService')
if not game.isLoaded() then
	game.Loaded:Wait()
end
UIS.MouseIcon = -- your icon id
UIS.MouseIconEnabled = true

This code is written in mobile and not tested tell if you encounter any errors

I changed game.IsLoaded() to game:IsLoaded() because the script wasn’t working before and still the same issue, works in studio, but in roblox the cursor is just the guibutton cursor.

And the issue only occurs when that script works, without it the cursor is just the normal roblox cursor and works fine.

seems like a roblox client bug

1 Like

Probably. This error only occurred after I edited the mouse icon script, the game was untouched for a while and I just recently started on it again. Before I edited it, the script worked.

a tempory workaround :
hide the mouse icon completely and make a new screengui and add a image label and center it and make it square using ui aspect ratio constant

edit : don’t forget to set ignoreinset or something like that to be true

1 Like

I’ll probably do this. I’ll just change the imagelabels image because I originally had the icon change images when a player clicked or interacted with an object.