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

How do I make a part that gets removed on click, but only a "Janitor" team can do it?

I'm making a game with a Janitor team in it, I'd like to know how to make a part that gets removed on click, but only the team Janitor can do it. If you have the answer / explanation, please tell me. Thanks!

2 answers

✓ Accepted answer

Add a ClickDetector to the part, then using a Script or LocalScript and listening to the clickdetector.MouseClick event, check if the player (MouseClick event also gives you the Player that clicked it) is in the janitor team... Then just delete it with part:Destroy()

Put this script under the part and the part should has a ClickDetector

local Teams = game.Teams

script.Parent.ClickDetector.MouseClick:Connect(function(Player)
if Player.TeamColor == game.Teams.Janitor.TeamColor then
script.Parent:Destroy()
end)

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