Activated (Event): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>ArceusInator +StudioTool |
m Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">" |
||
(10 intermediate revisions by 4 users not shown) | |||
Line 7: | Line 7: | ||
{{clear floats}} | {{clear floats}} | ||
{{Example|heading=Example (to be executed while a player is in the game)|< | {{Example|heading=Example (to be executed while a player is in the game)| | ||
This example prints "Tool activated" when a player clicks while 'tool' is equipped. | |||
<syntaxhighlight lang="lua"> | |||
local tool = Instance.new("Tool") | local tool = Instance.new("Tool") | ||
tool.Parent = game.Players.Player.Backpack | tool.Parent = game.Players.Player.Backpack | ||
Line 16: | Line 18: | ||
tool.Activated:connect(onActivation) | tool.Activated:connect(onActivation) | ||
</ | </syntaxhighlight>}} | ||
[[Category:Events]] | [[Category:Events]] |
Latest revision as of 06:17, 27 April 2023
Activated ( ) | |
Description | Fired when the player clicks while a tool is equipped. |
---|---|
Member of: | Tool, StudioTool |
Example (to be executed while a player is in the game)
This example prints "Tool activated" when a player clicks while 'tool' is equipped.
local tool = Instance.new("Tool")
tool.Parent = game.Players.Player.Backpack
function onActivation()
print("Tool activated")
end
tool.Activated:connect(onActivation)