Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

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