Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

if Tool.Open = true maybe?

2 answers

You would use the Equipped event.

If the script inside was a local script,

script.Parent.Equipped:connect(function() -- Runs the anonymous function when equipped

	game.Players.LocalPlayer.Character:BreakJoints() -- Kills the player who equipped the tool

end)

1 comment

0

My apologies for I neglected to mention HopperBins and I did not mention the unequipped event. Please up-vote Hashiru's answer.

Tool = script.Parent

function Equip()
	--Write your code here
end

function Unequip()
	--Write your code here
end

Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.