Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Cant change mouse curser?

Asked by
Marolex 45
10 years ago

So, as you can tell by the code it's trying to change the mouse curser. However, studio says it's unable to change the curser.

The code is running on a local script in a Gui.

Code:

mhid = false
mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:connect(function(key)
    key = string.lower(key)
    if string.byte(key) == 113 then
        if not mhid then
            mhid = true
            mouse.Icon = "http://www.roblox.com/asset/?id=20686724"
        elseif mhid then
            mhid = false
            mouse.Icon = ""
        end
    end
end)

Output: Cannot set Icon of a PlayerMouse

1 answer

Log in to vote
1
Answered by 10 years ago

Sadly you cannot use PlayerMouse to change the icon. What you have to do is make a hopperbin/Tool and force equip it then change the icon with that mouse. You can force equip it by using the :EquipTool and then game.StarterGui:SetCoreGuiEnabled(2, false) The SetCoreGuiEnabled makes it so the player cannot unequip the tool.

0
Players can unequip a tool using hockeys, even if the backpack CoreGui is disabled. Articulating 1335 — 10y
0
No they can't? If you want to test that then go here: http://www.roblox.com/Realms-place?id=142405423 PiggyJingles 358 — 10y
0
Alright, even though this is disappointing news, i appreciate the help. Thank you. Marolex 45 — 10y
0
@Articulating: Even if they can unequip it, then just have something checking to see if it isn't selected, and when it isn't, just reselect. PiggyJingles 358 — 10y
0
Nice answer ConnorVIII 448 — 10y
Ad

Answer this question