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

When does the Tool.Equipped:connect(function()end) event fire (And when doesn't it fire)?

Asked by 10 years ago

Why is this code not working (It should be working):

Tool = script.Parent 
function equip()
    print("Equipped")
end

function unequip()
    print("Unequipped")
end

script.Parent.Equipped:connect(equip)
script.Parent.Unequipped:connect(unequip)

In script: StarterPack (StarterPack) Tool (Tool) OnEquiped (LocalScript)

When I equip the tool, I want to print the message "Equipped" to the Output. This for some weird reason does not seem to work.

0
Is this script inside the tool in a local script? Darknesschaos 0 — 10y
0
Make sure the script is enabled. Perci1 4988 — 10y

2 answers

Log in to vote
0
Answered by
Tkdriverx 514 Moderation Voter
10 years ago

The tool has to have a Handle. It doesn't fire Equpped and Unequipped without it.

If you don't want a handle, then use a HopperBin.

Ad
Log in to vote
0
Answered by 10 years ago

Update: The following code (Executed through the console, while running the game in test mode) doesn't work either:

x = Instance.new("Tool")
x.Parent = game.Players.Player1.Backpack
x.Equipped:connect(function()print(":D")end)

Answer this question