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

How do I only allow group members to enter a certain team?

Asked by 5 years ago

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?

1 answer

Log in to vote
1
Answered by
metryy 306 Moderation Voter
5 years ago
Edited 5 years ago

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.

0
Do I put this in a script by itself? SxnisterReaper 2 — 5y
0
Yes metryy 306 — 5y
Ad

Answer this question