PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

Unequipped

The Unequipped event fires when a player unequips a Tool by putting in back in their Backpack. This event can be used to determine when a player stops using and puts a tool away.

The opposite of this event, Tool/Equipped, can be used alongside this event to determine when a player takes a tool out of their backpack to use.

The example shown below will print “A tool was unequipped” each time the tool is unequipped by the player. Please note that the below example assumes that you’ve already defined what “Tool” is.

Tool.Unequipped:Connect(function()
    print("The tool was unequipped")
end)


Code Samples


Player Fly Tool

The code below demonstrates the functionality of several Tool events, including Tool/Activated, Tool/Deactivated, and Tool/Unequipped.

The code, when placed in a LocalScript in the StarterPlayer.StarterCharacterScripts folder inserts and controls a tool in the Players/LocalPlayer|LocalPlayer's Backpack that allows the player to fly through the sky when used.

In order to ensure that the player stops flying when the player unequips the tool, the code uses the tool’s Unequipped event to turn set the fly boolean to true and turn stop flying until the tool is reequipped and activated again.