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

UnequipTools

This function unequips any Tool currently equipped by the Humanoid

The unequipped Tool will be parented to the Backpack of the Player associated with the Humanoid.

If no Tool is equipped, this function will do nothing.

Although Tool|Tools can be equipped by NPCs (Non Player Characters), this function only works on Humanoid|Humanoids with a corresponding Player. This is because a Backpack object is required to parent the unequipped Tool to.

See also

  • To instead equip a Tool, use Humanoid/EquipTool

Returns

Return Type Summary

Code Samples


Unequip Tool Keybind

The following sample will bind the U key to unequip any Tool|Tools the Player currently has equipped.

To use this sample, place it inside a LocalScript within StarterPlayerScripts|StarterPlayer.StarterPlayerScripts.

local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")

local localPlayer = Players.LocalPlayer

ContextActionService:BindAction("unequipTools", 
	function(_, userInputState)
		if userInputState == Enum.UserInputState.Begin then 
			if localPlayer.Character then 
				local humanoid = localPlayer.Character:FindFirstChildOfClass("Humanoid")
				if humanoid then 
					humanoid:UnequipTools()
				end
			end
		end
	end,
	false,
	Enum.KeyCode.U
)