Is this a bug or is my code wrong?

So I was making a custom cursor and It works perfectly fine in the studio but when I try to use it on Roblox on PC, it doesn’t show up. But the strange thing is that it works on the Microsoft Store version of Roblox. I think this is a bug but I’m not sure so I have to verify.

This is the code:

game.Players.LocalPlayer:GetMouse().Icon = "rbxassetid://11240226221"

What I want:
image

VS

What I’m getting:

1 Like

I had the same issue. I don’t really remember how to solve this directly but you could try setting UserInputService.MouseIconEnabled to true. I haven’t had much luck with changing the pointer icon, so I don’t think this feature is intended to be accessible outside of a tool.

2 Likes

I have a similar issue but mine is the cursor will not change icon, I think it’s a bug.

1 Like

Yeah I also think its a bug but idk

It should be a bug I don’t see anything wrong with the script but idk.

I got the same bug, I got it fixed when I used Roblox files instead of images

game.Players.LocalPlayer:GetMouse().Icon = "rbxasset://textures/Cursors/CrossMouseIcon.png"

Try making the ID into a shortcut. For example:

local Id = “rbxassetid://11240226221”
game.Players.LocalPlayer:GetMouse().Icon = Id

You could try making the cursor a UI that gets positioned to the mouse cursor position. Then disable the default mouse icon with UserInputService by doing

local UserInputService = game:GetService("UserInputService")
UserInputService.MouseIconEnabled = false

-- Position custom cursor to the mouse position (make sure to set the GUI anchor point!)

Yeah, this is what I’ve resolved to do, at least for now.

Greetings. Here is a plugin that i found. Cursor/Mouse Changing System - Roblox

I would recommend using game:GetService("UserInputService").MouseIconEnabled = false and then just using a custom GUI with an image label for the cursor. This is how I’ve done it to bypass this bug.

By the way, this only works for first person games. You will have to make a seperate script to get the icon to follow the mouse position, but that isn’t too difficult.

2 Likes

Yeah, that’s what I ended up doing. Here it is if anyone wants to use it.

Custom Cursor

I know my code may be all over the place so please excuse that.

1 Like