Hello, I have this problem every time I try to change the mouse icon in my game. This problem has happened to me in several games I’ve made before and I still haven’t found a solution.
The problem is that the mouse icon is only changed in the Roblox Studio play test, but is not changed in the game itself published on Roblox. The truth is I don’t know why this happens. And in the output it does not show any errors.
I have tried different things such as: putting the script in different places, using my own images, and modifying the scripts. But it doesn’t work anyway.
Here are the two scripts I used:
Script 1:
local player = game.Players.LocalPlayer
local Mouse = player:GetMouse()
if player then
Mouse.Icon = "rbxassetid://15722065980"
end
Script 2:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local function setMouseIcon()
mouse.Icon = "rbxassetid://15722065980"
print("Mouse icon set to:", mouse.Icon)
end
player.CharacterAdded:Connect(function(character)
wait(1) -- Give it a moment to fully load
setMouseIcon()
end)
if player.Character then
setMouseIcon()
end
If anyone has an answer or can help me, feel free to reply in this topic.
Thank you for reading
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
--local Mouse = player:GetMouse()
if player then
uis.MouseIcon = "rbxassetid://15722065980"
end
Script 2
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
--local mouse = player:GetMouse()
local function setMouseIcon()
uis.MouseIcon = "rbxassetid://15722065980"
print("Mouse icon set to:", uis.MouseIcon)
end
player.CharacterAdded:Connect(function(character)
wait(1) -- Give it a moment to fully load
setMouseIcon()
end)
if player.Character then
setMouseIcon()
end
The problem with the image asset you’re using is that it is around 400x400 pixels in size, mostly consisting of transparent space. There’s now a limit of 256x256 for the max cursor size, because of security concerns. I’d suggest cropping this image and reuploading it.