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

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

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

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.

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

2 comments

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?

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.

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