UnEquip

Constructor:

UnEquip()

Description

Triggered when the tool object itself is removed from the avatar.

Examples

Manually add a tool in WorkSpace and add the following script under the tool.

local curTool = script.Parent
local part = RWObject.Create("Part") -- create a part
part.Position = Vector3.New(2,1,2)
part.Parent = WorkSpace
part.CollisionEnter:Connect(function(hit) -- make the avatar equipped with the tool when touching the part.
  if hit:IsClass("Avatar") then 
     hit:EquipTool(curTool) -- equip the avatar with the created tool
  end
end)
part.CollisionExit:Connect(function(avatar) -- remove the tool from the avatar when the avatar leaves the part
  if avatar:IsClass("Avatar") then 
     avatar:UnEquipTool() -- remove the equipped tool
  end
end)
curTool.unEquip:Connect(function() -- register the event that is triggered when the tool is unequipped
    print("The event that the tool is unequipped is triggered")
end)