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

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

Asked by 3 years ago

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

Log in to vote
0
Answered by
Miniller 562 Moderation Voter
3 years ago
Edited 3 years ago

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()

Ad
Log in to vote
0
Answered by
SuperPuiu 497 Moderation Voter
3 years ago

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)

Answer this question