Class
Tool
An object, such as a weapon, that can be equipped by a Humanoid.
A Tool is an object that a Humanoid object can equip. For players,
they are stored in a Backpack object parented to a Player
object. In-experience, players may have multiple tools which appear as icons
at the bottom of the screen. Equipping a tool moves it from the
Backpack and into a Player.Character model in the
Workspace. By default, tools are held in the right hand and have a
handle in them, which is a BasePart named Handle inside (although
one isn't required if Tool.RequiresHandle is false). Tools that are
to be provided to (re)spawning players should be stored in the
StarterPack.
Properties 10#
CanBeDroppedboolean | Controls whether the player can drop the tool.ReadSafe |
Enabledboolean | Relates to whether or not the tool can be used.ReadSafe |
GripCFrame | Stores the tool's "grip" properties as one CFrame.ReadSafe |
GripForwardVector3 | Represents the R02, R12, and R22 values of the grip
CFrame rotation matrix.ReadSafeHiddenNotReplicated |
GripPosVector3 | The positional offset of the tool's weld matrix.ReadSafeHiddenNotReplicated |
GripRightVector3 | Represents the R00, R10, and R20 values of the grip
CFrame rotation matrix.ReadSafeHiddenNotReplicated |
GripUpVector3 | Represents the R01, R11, and R21 values of the grip
CFrame rotation matrix.ReadSafeHiddenNotReplicated |
ManualActivationOnlyboolean | Controls whether the Tool can be activated without executing
Tool:Activate().ReadSafe |
RequiresHandleboolean | Determines whether a Tool functions without a handle.ReadSafe |
ToolTipstring | Controls the message displayed when the player's mouse hovers over the tool in their backpack.ReadSafe |
CanBeDropped: boolean#
ReadSafe
Enabled: boolean#
ReadSafe
The Enabled property relates to whether or not the Tool can be
used. This is useful if you want to prevent a player from using a tool,
but don't want to remove it from their Backpack.
When set to true, the player can use the tool. When set to false, the
tool is disabled and the player cannot use it; this prevents the tool from
being activated or deactivated by the Tool:Activate() and
Tool:Deactivate() methods, and it prevents the
Tool.Activated and Tool.Deactivated events from firing.
Grip: CFrame#
ReadSafe
The Grip property stores the tool's "grip" properties as a single
CFrame. These properties position how the player holds the tool
and include GripUp, GripRight,
GripForward, and GripPos.
GripForward: Vector3#
HiddenNotReplicatedReadSafe
One of the properties that specifies a tool's orientation in a character's
hand. This represents the R02, R12, and R22 values of the grip
CFrame rotation matrix.
Other tool properties that control how a character holds a tool include
Tool.GripUp, Tool.GripRight, and Tool.GripPos. All
of these properties are stored in a single CFrame in the
Tool.Grip property.
GripPos: Vector3#
HiddenNotReplicatedReadSafe
This property controls the positional offset of the tool's weld matrix. It is one of several properties used to position how the player character holds the tool.
Other properties that control how a character holds a tool include
Tool.GripUp, Tool.GripRight, and Tool.GripForward.
All of these properties are stored in a single CFrame in the
Tool.Grip property.
GripRight: Vector3#
HiddenNotReplicatedReadSafe
One of the properties that specifies a tool's orientation in a character's
hand. This represents the R00, R10, and R20 values of the grip
CFrame rotation matrix.
Other tool properties that control how a character holds a tool include
Tool.GripUp, Tool.GripForward, and Tool.GripPos.
All of these properties are stored in a single CFrame in the
Tool.Grip property.
GripUp: Vector3#
HiddenNotReplicatedReadSafe
One of the properties that specifies a tool's orientation in a character's
hand. This represents the R01, R11, and R21 values of the grip
CFrame rotation matrix.
Other tool properties that control how a character holds a tool include
Tool.GripRight, Tool.GripForward, and
Tool.GripPos. All of these properties are stored in a single
CFrame in the Tool.Grip property.
ManualActivationOnly: boolean#
ReadSafe
This property controls whether the Tool can be activated without
explicitly executing Tool:Activate() in a script.
When set to true, the tool will only fire Tool.Activated when
Tool:Activate() is called. This also suppresses the
ContextActionService:BindActivate() function.
When set to false, mouse clicks (when the tool is equipped) will also
fire Tool.Activated.
RequiresHandle: boolean#
ReadSafe
This property determines whether a Tool functions without a
handle.
A tool has a handle when it contains a child part named Handle. Tools with handles typically require the player equipping them to hold an object to use them, for instance weapons. Tools without handles typically don't require the player equipping them to hold anything to use them, for instance "fly" or "summon" tools.
When set to true, the tool will function only with a handle. When set to
false, the tool will function even without a handle.
ToolTip: string#
ReadSafe
The ToolTip property controls the message that will be displayed when the
player's Mouse hovers over the Tool in their
Backpack.
Generally, the value of this property should describe the what the tool is or its use. For instance, for a shovel tool, you may choose to set the ToolTip to:
tool.ToolTip = "Shovel"or
tool.ToolTip = "Use to dig"or
tool.ToolTip = "Shovel - Use to dig"Methods 2#
| Activate | Simulates activation of the Tool. |
| Deactivate | Simulates deactivation of the Tool. |
Events 4#
| Activated | Fires when the player clicks while the tool is equipped. |
| Deactivated | Fires when the player releases their click while the tool is equipped and activated. |
| Equipped | Fires when the tool is equipped. |
| Unequipped | Fires when the tool is unequipped. |
Activated()#
This event fires when the player clicks while the Tool is
equipped. It is not fired if the Ctrl key is pressed during
the click.
This event is typically used to perform an action when the player uses the tool, for instance to launch a rocket from a rocket launcher weapon tool.
The below code, when placed in a LocalScript, creates a tool in
the local player's Backpack and prints "Tool activated" when the
player clicks while the created tool is equipped.
Deactivated()#
This event fires when the player releases their click while the
Tool is equipped and activated. It is typically used to perform an
action when the player stops using a tool.
The below code, when placed in a LocalScript, creates a tool in
the local player's Backpack and prints "Tool deactivated" when the
player releases their click while the tool is equipped and activated.
Equipped(mouse: Mouse)#
This event fires when a player equips the Tool (takes it out of
their Backpack).
The opposite of this event, Tool.Unequipped, can be used to
determine when the player unequips the tool by putting it in their
backpack.
Note that this event does not fire when Tool.RequiresHandle is
enabled and no handle is present.
| Name | Type | Default | Description |
|---|---|---|---|
mouse | Mouse | The player's mouse. |
Unequipped()#
This event fires when a player unequips the Tool (puts it in their
Backpack).
The opposite of this event, Tool.Equipped, can be used to
determine when the player equips the tool by taking it out of their
backpack.
Note that this event does not fire when Tool.RequiresHandle is
enabled and no handle is present.
Inherited members#
Inherited from BackpackItem 2
Properties (2)
Inherited from Model 26
Properties (5)
LevelOfDetail, ModelStreamingMode, PrimaryPart, Scale, WorldPivot
Methods (21)
AddPersistentPlayer, BreakJoints, breakJoints, GetBoundingBox, GetExtentsSize, GetModelCFrame, GetModelSize, GetPersistentPlayers, GetPrimaryPartCFrame, GetScale, MakeJoints, makeJoints, move, MoveTo, moveTo, RemovePersistentPlayer, ResetOrientationToIdentity, ScaleTo, SetIdentityOrientation, SetPrimaryPartCFrame, TranslateBy
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild