继承自:
会切换装备已有的工具
 | 
|---|
| 已装备的的工具,模拟点击使用,会触发Activated事件。 | 
 
 local tool = script.Parent
 local playersService = game:GetService("Players")
 local localPlayer = playersService.LocalPlayer
 local ContextActionService = game:GetService("ContextActionService")
 local function testEquipTool(actionName, inputState, inputObj)
	 if inputState == Enum.UserInputState.InputBegin.Value then
		 localPlayer:EquipTool( tool )
	 end
 end
 ContextActionService:BindAction(
	 "testEquipTool",
	 testEquipTool,
	 Enum.ContextActionType.KeyBoard.Value,
	 string.byte('X') )
 local function testUnequipTool(actionName, inputState, inputObj)
	 if inputState == Enum.UserInputState.InputBegin.Value then
		 localPlayer:UnequipTools()
	 end
 end
 ContextActionService:BindAction(
	 "testUnequipTool",
	 testUnequipTool,
	 Enum.ContextActionType.KeyBoard.Value,
	 string.byte('Z') )