How to detect if a tool is being held or not

I want to create a server script that checks if the player is holding a sword. If they are not holding the sword, I want it to appear welded to their torso as if it were ‘sheathed.’ If they are holding it, I want to destroy/make transparent the sheathed sword so that it appears only in their hand.

I’ve tried a few if/while statements with some booleans but am struggling to figure out how to fit it all together. I know that if someone has a tool equipped, it no longer appears in their backpack in the explorer. Maybe that’s a place to start?

with tool.Unequipped you will know when the tool is no longer being held

use this event to know when to appear the tool on their back. then use its opposite tool.Equipped to know when to remove it from their back

This returns that the sword is equipped regardless of if it is or not.

if playerSword.Equipped then
				print("Sword Equipped!")
			end

Additionally, I ran .Uneuipped and had the same issue.

You would need to use the playerSword.Equipped or player.Unequipped as an event instead of trying to see if it is true or false, so something like:

playerSword.Unequipped:Connect(function()
--Your code here
end)
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.