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

I need to check if a Tool in the inventory is selected without using Tool.Equipped?

So, I wanted to create a tool, similar to in Arcane Adventures, where when you have it selected and press a button, it executes a magical attack.

So, in order to find out when the player has the tool equipped or unequipped, I used the "Tool.Equipped" function. As it turns out, the "Tool.Equipped" function only works if the tool in question has a Handle part. Which I don't want.

Is there a reliable way to find out if a tool is selected without using Tool.Equipped?

Thank you!

2 answers

✓ Accepted answer

Actually, yes! When you equip a tool, the tool's parent becomes your character, meaning you can create a variable called IsEquipped, and creating an event detecting if the Tool's parent is in the character. Hope this helped!

4 comments

0

So if the tools parent is the character's parent its parent is the workspace?

0

Oops let me fix that

0

Ah, I see! When you select a tool, it is parented to the character. So if the tool's parent is not the character, the player hasn't selected it, but if it is, the player has it selected currently. Thanks for the info!

0

No problem!

###First, Equipped is not a function, it is an event. You can check if a tool is equipped by checking the character. When a tool is equipped, it gets parented to the character, and when unequipped, it goes back into the backpack. Also, you can check if a tool is equipped without a Handle part. Set the RequiresHandle property of your Tool to false.

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