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

How would I have a main group and divisions go into different teams?

Asked by 4 years ago
Edited 4 years ago

I have a main group and also some divisions. I need to put the people that are in a specific group for example a division on a specific team, but if they are not in any of the divisions they need to be put on a team aswell. I have been looking everywhere for a solution, but I haven't found anything yet. Here is my script:

local BlueGuys = 6172517
local CG = 6171056
local RG = 6219902
local RI = 6200727
local GreyGuys = 6282717
local swrf = 5841578
local RC = 6496645
local Dev = {72947278, 64913141}

function onPlayerAdded(player)
        if player:IsInGroup(BlueGuys) then
            player.TeamColor = BrickColor.new("Dark blue")
            player:LoadCharacter()
        elseif player:IsInGroup(CG) then
            player.TeamColor = BrickColor.new("Crimson")
            player:LoadCharacter()
        elseif player:IsInGroup(RG) then
            player.TeamColor = BrickColor.new("Really red")
            player:LoadCharacter()
        elseif player:IsInGroup(RI) then
            player.TeamColor = BrickColor.new("Really black")
            player:LoadCharacter()
        elseif player:GetRankInGroup(swrf) == 0 then
            player.TeamColor = BrickColor.new("Dark stone grey")
            player:LoadCharacter()
        elseif table.find(Dev, player.UserId) then
            player.TeamColor = BrickColor.new("Institutional white")
            player:LoadCharacter()
        elseif player:IsInGroup(RC) then
            player.TeamColor = BrickColor.new("Sand green")
            player:LoadCharacter()
        end
    end

game.Players.PlayerAdded:Connect(onPlayerAdded)

If anyone could help me out it would make my day. I am also new to scripting.

Answer this question