Mouse Icon not changing

I have this code here

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
mouse.Icon = 'rbxassetid://139060441101495'

the issue I’m having is when I playtest in studio the mouse icon does get set but when I playtest on Roblox it doesn’t want to set. Anyone know what I could do to fix this?

1 Like

Using UserInputService’s MouseIcon property is the recommended way of changing the mouse icon:

-- Needs to be a LocalScript or a server Script with its RunContext set to Client
local UserInputService = game:GetService("UserInputService")
UserInputService.MouseIcon = "rbxassetid://139060441101495"
1 Like

Perhaps try waiting; it may need some time

1 Like

I just tried this and it still doesn’t work. I have it in a local script inside of StarterPlayerCharacter. Could that be the issue?

2 Likes

It should work as a LocalScript in StarterPlayerScripts, so the issue is being caused by something else. Are you changing the mouse icon in another script?

1 Like

I’m not changing it anywhere else no

2 Likes

You’re the second person I’ve encountered today which is experiencing an issue related to the player’s mouse, each working correctly in Studio but not when using the Player, so I’m really starting to suspect that there’s a bug that’s causing these problems


@RealStunZ

Try changing both the Mouse.Icon and the UserInputService.MouseIcon:

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")

local MOUSE_ICON = "rbxassetid://139060441101495"

local mouse = Players.LocalPlayer:GetMouse()

UserInputService.MouseIcon = MOUSE_ICON
mouse.Icon = MOUSE_ICON

Just gave that a try and I’m still getting this


and sometimes it’ll just be the mouse cursor itself.
If its a bug then I’ll just wait till its fixed. Thank you for your help though.

Meant to just look like this

1 Like

It’s possible that other scripts are interfering with your mouse icon. If that’s not the issue, a good solution is to update the mouse icon every frame. You can do this with the following code:

game:GetService("RunService").RenderStepped:Connect(function()
    game:GetService("UserInputService").MouseIconEnabled = true
    mouse.Icon = 'rbxassetid://139060441101495'
end)

Used to have the same problem so I loaded up that game and this is what I used for a custom mouse:

local uis = game:GetService("UserInputService")
uis.MouseIcon = "http://www.roblox.com/asset/?id=10523820438"

It takes a couple of seconds for the mouse to load in, but it works.


Maybe you have the wrong link? Try a Roblox web link. The ID from a rbxassetid link might differ to a web link so you may not be able to just paste the ID into the web link (iirc).