This should work:

local ClickDetector = script.Parent --The ClickDetector
local AllowedTeam = game.Teams.AllowedTeam --Direction to the Team which is allowed

ClickDetector.MouseClick:Connect(function(Player)
	
	if Player.Team == AllowedTeam then
		
		--Whatever you want to happen if the player clicks and is in the team
		
	end
	
end)

Make sure its an normal Script, not an Module or Local Script