So basically, I’m getting a strange error. I have written code in that would automatically assign a user to their team based on their group rank in this group and this group.
As you can tell by the title, I keep on getting the same error over and over again. In the script below, line 24 is having issues.
I have rewritten it multiple times, and I’m probably just too tired to function properly. (It’s 12:50 AM and I woke up early today.)
game.Players.PlayerAdded:connect(function(newPlayer)
local rank = newPlayer:GetRankInGroup(6584195)
local teamName = ""
if rank == 255 then
teamName = "king"
elseif rank == 254 or 253 then
teamName = "dancebattle"
elseif rank == 1 then
teamName = "onionLR"
elseif rank == 5 or rank == 6 or rank == 7 or rank == 8 or rank == 9 then
teamName = "onionLR"
elseif rank == 10 or rank == 11 or rank == 12 or rank == 13 or rank == 14 then
teamName = "onionHR"
elseif rank == 15 or rank == 251 then
teamName = "onionHICOM"
end
newPlayer.TeamColor = game.Teams[teamName].TeamColor
local rank1 = newPlayer:GetRankInGroup(6898035)
local teamName1 = ""
if rank1 == 1 or rank1 == 2 or rank1 == 3 or rank1 == 4 or rank1 == 230 then
teamName1 = "onionGuard"
end
newPlayer.TeamColor = game.Teams[teamName1].TeamColor --ERROR OCCURS RIGHT HERE
end)
Thanks for the help, I’m going to bed.