We use cookies on this site to enhance your user experience

Intro to Player Tools – Weapons, Wands, etc.

Intro to Player Tools – Weapons, Wands, etc.

Jul 23 2018, 8:58 AM PST 15 min

Tools are a special instance used to implement weapons, wands, and other interactive tools. In this tutorial, you’ll learn how to create tools, where to put them in the game hierarchy, and how to write a basic tool script.

Creating a Tool

All tools begin as an empty container which holds all of the instances that make up the tool, including parts, sound effects, and the scripts which provide functionality.

Creating the Tool Container

To create a new tool container:

  1. In the Explorer window, hover over Workspace and click the button.

  2. Under the Interaction section, select Tool.

Inserting Parts or Meshes

Any parts or meshes added to the tool will be the model that players see. You can create swords, rocket launchers, magic wands, or almost any tool you’d like!

Just like other models, tools can be made out of multiple parts. Since players will carry tools around (or swing them wildly like a sword!), the tool’s parts should be welded together using Weld constraints.

Setting the Tool Handle

Tools that players carry must contain a single part named Handle. The handle is where the tool will attach to the player’s hand.

For example the magic wand below is actually split into three parts: the glowing tip, the main body, and the red handle. When a player equips the wand, they’ll hold it at whichever part is named Handle.

Changing the Tool Grip

If your tool is dragging on the ground or facing backwards, you can fix it by changing the tool’s grip properties.

Every tool is different, so you’ll need to experiment with changing the values next to the GripForward, GripRight, and GripUp properties until the tool looks correct.

Tool dragging on ground
Tool facing backwards
Tool oriented correctly

Tools can also be offset from the character’s hand with the GripPos property. This can be useful when making a tool that should appear to rest on the player’s shoulder.

Default offset (0,0,0)
Tool offset to shoulder

Customizing the Tool Icon

Tools that a player owns are stored in their Backpack. On screen, this is represented by an action bar which shows each tool in the backpack.

Use the following properties to customize the tool’s appearance in the action bar:

  • TextureID — The tool icon. Set the image ID for this property the same way as decals, image buttons, etc.
  • ToolTip — The on-hover tooltip name.

Can/Can’t be Dropped

By default, a player can drop a tool by pressing the Backspace key (delete on macOS). You can disable this option by setting the CanBeDropped property of the tool to false. If CanBeDropped is false, pressing Backspace or delete will return the tool to the player’s backpack.

Adding Tools to a Game

Once your tool is set up, it should be placed in the proper area of your game’s object hierarchy.

Default Starting Tool

If you want all players to start out with a tool in their inventory, put it inside the StarterPack folder. When any player spawns, the tool will get copied to their backpack.

Collectible Tool

A tool can be placed in the workspace if players will be able to collect it as they explore. For example, you might place a super rocket launcher in a hard-to-reach area of your game world.

Earned/Purchased Tool

Some tools should be awarded when a player does something special, or offered for sale in an in-game store. These should be put inside ServerStorage and then cloned to the player’s backpack at the proper time.

Bringing Tools to Life

To make tools do interesting things in the game world, you’ll need to add scripts.

Tool-Specific Events

There are four tool-specific conditions you can work with in a tool scrip. These indicate the state of the tool and the player’s input with it.

Tool/Equipped|Equipped Occurs when the player selects the tool from their backpack.
Tool/Unequipped|Unequipped Occurs when the player drops the tool or switches tools.
Tool/Activated|Activated Occurs when the player starts activating the tool (clicks, taps, or presses A on a gamepad).
Tool/Deactivated|Deactivated Occurs when the player stops the activation input (releases the button or touch).

Although you might not need all four conditions when designing a tool, this code can be used as a basic tool script template:

local tool = script.Parent

local function onEquip()
local function onUnequip()

local function onActivate()
local function onDeactivate()


Adding a Basic Script

Here’s how to add a simple server script (Script) to a tool. When equipped, the player will be able to click the screen to change night to day and vice-versa.

  1. In the Explorer window, hover over the tool container, click the and insert a Script.
  1. Copy the following code and paste it into your script.
local tool = script.Parent

local function onActivate()
	if game.Lighting.ClockTime >= 8 and game.Lighting.ClockTime < 16 then
		game.Lighting.ClockTime = 20
		game.Lighting.ClockTime = 8
  1. Playtest your game, pick up the tool, and then click anywhere in the game world. The time of day should change from night to day and vice-versa with each click!

Script vs. LocalScript

The above example uses just a server script (Script), but most tools will require both a server script and a local script (LocalScript) where each takes care of certain aspects of the tool’s behavior.

Remember these core differences between each script type:

  • Script — Manages changes within the overall game world, visible to all players, like unlocking a door, shooting an arrow, etc.
  • LocalScript — Manages things that happen only on the player’s computer/device, like detecting exactly where the screen is touched or clicked.

Here are some example tools and the aspects which would be managed by either a local script or a server script:

Tool Local Script Server Script
Creator's Wand Detects where the player touches or clicks on the screen. Creates a new part at the location within the game world where the player touched or clicked.
Invisibility Cloak Temporarily makes the player invisible to all other players, while the cloak is equipped.
Mega-Bow Detects how long the player activates the tool (time between activation and deactivation). Shoots a magical arrow with greater or lesser power, depending on the detected activation time.

You should now be familiar with designing tools, adding them to your game, and writing scripts to give them awesome powers!