What on earth is wrong with my cursor

I’m not too sure if it’s because of the script or something else so I’m putting it in scripting support. However I just have a basic script in StarterPlayerScripts that simply changes the mouse icon to a 5x5 square.

In studio it works fine however inside of roblox it becomes red and transparent in certain regions, which can make it look like bars.

I’ve done some diving and I figured one potential thing could be the cursor image I uploaded, however the image is a png, 5x5, and only 129 BYTES. There’s no way the cursor is the issue right?

Here’s the script:

local UIS = game:GetService("UserInputService")
UIS.MouseIconEnabled = true
UIS.MouseIcon = "rbxassetid://126874732519911"

I would like to show an example of the cursor difference, but for some reason my cursor isnt picking up in my screenshots or anything.

1 Like

The exact problem you’re having was fixed here Mouse Icon is colored in game - #2 by superlaser60

I already saw that page and I tried it myself, doesn’t work though unless I’m doing it wrong.

UIS.MouseIconEnabled = true
UIS.MouseIcon = script.Parent.Icon.ImageLabel.Image
print(UIS.MouseIcon)

image

Also in Roblox it does print the MouseIcon id the same as in the label

Wait so what does your custom cursor do? Is it like something special or is it just a cursor?

The ImageLabel should act as the cursor itself, rather than a placeholder for the image id. Set the position of the ImageLabel to the position of the mouse within a loop (RenderStepped).
Example:

Blockquote
ImageLabel.Position = Udim2.fromOffset(Player:GetMouse().X, Player:GetMouse().Y)

Make sure MouseIconEnabled is set to false such that the default cursor doesn’t override the ImageLabel, and the ImageLabel anchor point is set to (0.5,0.5). This represents the pivot point of the image label, which will position the center of your image label to the mouse (rather than the top-left).

2 Likes

Yeah I initially wanted to avoid the ImageLabel but it works so I’ll stick with that, it allows for easier cursor customization anyways so why not