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

ClickDetector to remove tool?

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago
script.Parent.ClickDetector.MouseClick:connect(function(player)
game.Workspace:WaitForChild(player.Name):FindFirstChild("Cola"):Destroy()
end)

Script in the part NOT the click detector

0
This script works if the player is NOT holding the tool, if the player is, then it would come with an error. Ap_inity 112 — 6y
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. OneFatDollar 2 — 6y
Ad

Answer this question