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

How would I make a script detect if I have a tool in my hand and then go on with the action?

Asked by 4 years ago

So im in my test world (trying something for a lifting spell) but I want the part to notice that I am holding a tool and then do it, while also detecting if I dont have it and then do nothing.

you dont need to give like a big answer or anything, but a link to a dev article or something would be nice,

I will edit this question if you want to see my current script (doesnt have any tool detection, but has a click detection)

2 answers

Log in to vote
0
Answered by 4 years ago

Make an event for when the sword is equipped it would run. Then make the script and put it into serverscriptservice doing the action when it is equipped.

Ad
Log in to vote
0
Answered by
Omzure 94
4 years ago
Edited 4 years ago

You can use '.Equipped' and '.Unequipped'

tool.Equipped:Connect(function()

    --script

    tool.Unequipped:Connect(function()

    --script

end)

if you want more information go here: Equipped and Unequipped

0
So lets just say I wanted to use this with a click detector script, how would I tell it to dont do anything when unequiped? snipperdiaper 120 — 4y
0
If you put the functions inside the "Equipped" block, it will only fire when the tool is 'Equipped'. Other than that, or when the tool is 'Unequipped', it will not do anything, unless you stated something within if of course. Padugz 40 — 4y

Answer this question