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

How do I make a Group member team?

I have my team switching gui now i don't want non group members to join my team How do i script it as only group members can join this team and non group can join this team?

2 answers

Hi there,

You can use IsInGroup() to find out if a player is in the group. If so, team them into your team.

Inside a server script, type out these lines of codes.

--if you don't already have a team, create a team (Exclude this portion if you have already created one)
local grpteam = Instance.new("Team")
--Customize your team with colours and names here before moving on
grpteam.Name = "Insert Name Here"
grpteam.Parent = game:GetService("Teams")

--Check if player is in group
game.Players.PlayerAdded:connect(function(Player)
	if Player:IsInGroup(GroupIDHere) then
	Player.Team = grpteam
end

So, the script creates a team, checks for player entrance, and teams them if they are in the group.

If you're using a team switching gui, try this instead.

script.Parent.MouseButton1Click:connect(function(player)
if player and player:IsInGroup(groupid) then -- change "groupid" to your group id
player.TeamColor = BrickColor.new("Color of the team") -- change "color of the team" to the group team's color
end
end)

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