Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to change the mouse cursor back to normal?

Can anyone tell me how to change the player's cursor back to normal? The error I keep getting with the code below is attempt to index local 'mouse' (a nil value) on line 8. I've also tried Mouse.Icon = "" but that doesn't work either.

Code I've tried using:

local Tool = script.Parent

Tool.Equipped:connect(function(Mouse)
	Mouse.Icon = "http://www.roblox.com/asset/?id=131581677"
end)

Tool.Unequipped:connect(function(Mouse)
	Mouse.Icon = "http://www.roblox.com/asset/?id=0"
end)

Any help appreciated.

1 answer

✓ Accepted answer

Unequipped doesn't pass the Mouse to listening functions while Equipped does. You want to use the :GetMouse() function.

local Tool = script.Parent

Tool.Equipped:connect(function(Mouse)
    Mouse.Icon = "http://www.roblox.com/asset/?id=131581677"
end)

Tool.Unequipped:connect(function()
    game.Players.LocalPlayer:GetMouse().Icon = "" -- Also, use an empty string here so that it doesn't cause any unnecessary errors
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.