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

how do I do so that if a player not in the group joins he spawns in the team called Civilan?

Asked by 5 years ago

how do I do so that if a player not in the group joins he spawns in the team called Civilan

game.Players.PlayerAdded:connect(function(P)
    repeat wait() until P:findFirstChild("leaderstats")
    local Rank = Instance.new("StringValue", P.leaderstats)
    Rank.Name = "Rank"
    Rank.Value = P:GetRoleInGroup(2671856)
end)

game.Players.PlayerAdded:connect(function(newPlayer)
    local rank = newPlayer:GetRankInGroup(2671856) 
    local teamName = ""
    if rank == 255 then 
        teamName = "Officers [O1-O10]" 
    elseif rank == 17 then
        teamName = "Officers [O1-O10]"
    elseif rank >= 16 then
        teamName = "Officers [O1-O10]"
    elseif rank >= 15 then
        teamName = "Officers [O1-O10]"
    elseif rank > 14 then
        teamName = "Officers [O1-O10]"
    elseif rank > 13 then
        teamName = "Officers [O1-O10]"
    elseif rank > 12 then
        teamName = "Officers [O1-O10]"
    elseif rank > 11 then
        teamName = "Officers [O1-O10]"
    elseif rank > 10 then
        teamName = "Officers [O1-O10]"
    elseif rank > 9 then
        teamName = "Officers [O1-O10]"
    elseif rank > 8 then
        teamName = "Enlisted[E1-E9]"
    elseif rank > 7 then
        teamName = "Enlisted[E1-E9]"
    elseif rank > 6 then
        teamName = "Enlisted[E1-E9]"
    elseif rank > 5 then
        teamName = "Enlisted[E1-E9]"
    elseif rank > 4 then
        teamName = "Enlisted[E1-E9]"
    elseif rank > 3 then
        teamName = "Enlisted[E1-E9]"
    elseif rank > 2 then
        teamName = "Enlisted[E1-E9]"
    elseif rank > 1 then
        teamName = "Enlisted[E1-E9]"


end
    newPlayer.TeamColor = game.Teams[teamName].TeamColor
end)

1 answer

Log in to vote
0
Answered by 5 years ago

It's simple. just add this extra line

elseif rank == 0 then --whatever code you need

0 is the rank of someone that is not in the group.

Hope I helped, good luck!

Accept answer if this helped.

Ad

Answer this question