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 only allow group members to enter a certain team?

1 answer

You can use the player:IsInGroup(int64 GroupId) function to check if a player is in your group or not.

Example:

local GroupId = 12345

game:GetService("Players").PlayerAdded:Connect(function(player) 
	if player:IsInGroup(GroupId) then -- checks to see if they are a member of the group
		player.Team = game.Teams.Red -- if they are it teams them to the red team
	else
		player.Team = game.Teams.Blue -- if not it teams them to the blue team
	end
end)

Hope this helps.

2 comments

0

Do I put this in a script by itself?

0

Yes

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