Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is the event for when a tool is in use?

Asked by 11 years ago

Like I just pressed 1 to open the tool and I want something to happen

if Tool.Open = true maybe?

2 answers

Log in to vote
1
Answered by
Aethex 256 Moderation Voter
11 years ago

You would use the Equipped event.

If the script inside was a local script,

1script.Parent.Equipped:connect(function() -- Runs the anonymous function when equipped
2 
3    game.Players.LocalPlayer.Character:BreakJoints() -- Kills the player who equipped the tool
4 
5end)
0
My apologies for I neglected to mention HopperBins and I did not mention the unequipped event. Please up-vote Hashiru's answer. Aethex 256 — 11y
Ad
Log in to vote
1
Answered by 11 years ago
01Tool = script.Parent
02 
03function Equip()
04    --Write your code here
05end
06 
07function Unequip()
08    --Write your code here
09end
10 
11Tool.Equipped:connect(Equip)
12Tool.Unequipped:connect(Unequip)

Don't forget your Handle in the tool! And if you are using "HopperBin" it's:

1Tool.Selected:connect(Equip)
2Tool.Deselected:connect(Unequip)

Answer this question