I want to able to have group members that can only click the right team, example in the military groups if you ain't a certain division you can't access that division, so how do I make that possible?
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.

1 comment
https://developer.roblox.com/api-reference/function/Player/IsInGroup