Skip to content

Tool Functions

Functions related to managing and interacting with tools within the game world.


equiptool

Equips a tool to the local player.

Lua
equiptool(toolInstance)

Parameters: - toolInstance (Instance): Tool instance to equip

Example:

Lua
1
2
3
4
5
-- Equip a tool from Backpack
local player = game["Players"].LocalPlayer
local backpack = player:FindChild("Backpack")
local tool = backpack:FindChild("MyTool")
equiptool(tool)


unequiptool

Unequips the currently equipped tool.

Lua
unequiptool(toolInstance)

Parameters: - toolInstance (Instance): Tool instance to unequip

Example:

Lua
1
2
3
4
local player = game["Players"].LocalPlayer
local backpack = player:FindChild("Backpack")
local tool = backpack:FindChild("MyTool")
unequiptool(tool)


activatetool

Activates a tool (triggers its activated event).

Lua
activatetool(toolInstance)

Parameters: - toolInstance (Instance): Tool instance to activate

Example:

Lua
1
2
3
4
5
6
local player = game["Players"].LocalPlayer
local backpack = player:FindChild("Backpack")
local tool = backpack:FindChild("Sword")
equiptool(tool)
wait(0.1)
activatetool(tool)


serverequiptool

Equips a tool to any player (server-side).

Lua
serverequiptool(player, toolInstance)

Parameters: - player (Player): Target player - toolInstance (Instance): Tool instance to equip

Example:

Lua
1
2
3
4
5
local Players = game["Players"]
local player = Players:FindChild("PlayerName")
local tool = game["Environment"]:FindChild("Tool")

serverequiptool(player, tool)