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

ClickDetector to remove tool?

I have a part with a ClickDetector. How do I make it so that when a player clicks this brick, the tool 'Cola' is removed from their hotbar? Thanks.

1 answer

✓ Accepted answer
script.Parent.ClickDetector.MouseClick:connect(function(player)
game.Workspace:WaitForChild(player.Name):FindFirstChild("Cola"):Destroy()
end)

Script in the part NOT the click detector

2 comments

0

This script works if the player is NOT holding the tool, if the player is, then it would come with an error.

0

That shouldn't matter, because when your holding the tool you cannot click the part. This just means my players will deselect the tool to be able to click. Works great, thanks a lot.

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