So, the code below is a part of a gun script I am working on. I want to make it so when the weapon is unequipped your cursor returns to default, I am not sure why this wont work.
function un(mouse) mouse.Icon = nil end tool.Unequipped:connect(un)
This is in a local script. This is only a part of the script that deals with unequipping
Error:
13:44:25.265 - Players.Player1.Backpack.Disrupter.IFF:45: attempt to index local 'mouse' (a nil value)
13:44:25.266 - Stack Begin
13:44:25.266 - Script 'Players.Player1.Backpack.Disrupter.IFF', Line 45
13:44:25.266 - Stack End
13:44:25.267 - Disconnect
All help is appreciated, thanks!
The mouse cannot be used after the tool has been equipped, which is why your script is breaking.
That being said, you should not have to reset the icon yourself, the mouse icon will automatically reset itself the Tool is Unequipped. If it does not, double check UserInputService.MouseIconEnabled
.