Issues with Mouse Icon for a Gun System

I need help with the player mouse

I’m trying to make the cursor change to a dot. It works in studio, but not in-game.

yes = now aiming, cursor should appear
no = no longer aiming, cursor texture goes to “”

mi = current mouse icon according to Mouse.Icon
ci = crosshair icon

Relevant code:

function MouseHandler()
    UserInputService.MouseIconEnabled = true
    UserInputService.MouseBehavior = Enum.MouseBehavior.Default
    if Aiming then
        Mouse.Icon = CrosshairIcon
        print("\nyes\nmi:"..Mouse.Icon.."\nci:"..CrosshairIcon)
    else
        Mouse.Icon = ""
        print("\nno\nmi:"..Mouse.Icon.."\nci:"..CrosshairIcon)
    end
end

function Aim()
    if Aiming then
        Aiming = false
        AnimationHandler("Stop","Aim")
        AnimationHandler("Play","Carry")

    else
        Aiming = true
        AnimationHandler("Stop","Carry")
        AnimationHandler("Play","Aim")
    end

    MouseHandler()
end

Tool.Equipped:Connect(function()
    Mouse = Player:GetMouse()
    AnimationHandler("Stop","All")
    AnimationHandler("Play","Carry")
    MouseHandler()
end)

Tool.Unequipped:Connect(function()
    AnimationHandler("Stop","All")
    Aiming = false
    MouseHandler()
end)

script.Destroying:Connect(function()
    AnimationHandler("Stop","All")
    Aiming = false
    MouseHandler()
end)

I have already tried many things, such as adding Mouse.Icon = CrosshairIcon and Mouse.Icon = "". I have also asked for help on RoDevs, to which, I still got no solutions.

studio cursor: image below (the dot)
game cursor: the default roblox cursor when you hover over a button or thing that you can click
image

Mouse.Icon (mi) shows the mouse has changed to the proper texture (ci), but it’s still the default tool cursor, even though the status of Mouse.Icon (mi) says otherwise
image

Any help would be greatly appreciated.

1 Like

Try moving this outside of the equipped event.

Also, Mouse.Icon will be deprecated soon, use UserInputService.MouseIcon if you can.

1 Like

Use the RobloxAPI to change your mouses icon correctly.

RobloxAPI:ChangeMouseIcon(Id.."RbxaSeetId..//2359")

Still no difference. I’ll probably try to change the image and see if it’s actually the image causing the issue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.