What I am trying to do is if the player is in a group, a stat will show up as their rank in the group, if they are not in the group.. their stat will be "Guest". At the same time I am trying to make it so if they are in a certain rank in the group they will be on the team Bright Red, or team name DJ.
I don't see why this does not work except I may have assigned the players team incorrectly..
local playerStats = {} --this keeps a list of the stats for each player that enters the game
game.Players.PlayerAdded:connect(function(player) --Added function
local leaderstats = Instance.new("Model", player) --Make leadeerstats
leaderstats.Name = "leaderstats" --Change the name...
local grouprank = Instance.new("StringValue", leaderstats) --assign the variable
grouprank.Name = "Rank" --set up value
local rank = player:GetRoleInGroup(1066846) --Get the group rank from group
if rank ~= 0 then --If user is in group...
grouprank.Value = rank --Then assign them the rank
else
grouprank.Value = "Guest" --They are not in group so they get this rank on the leaderboard
end
if rank ~= 75 then --If user is rank number 75, assign them to team name DJ
local team = game:GetService("Teams") --Get the Team service
player.team = DJ --Change the players team to DJ, Should I do team color? problem could be right here
playerStats[player] = leaderstats
end
end)

6 comments
When I tested it, it did not make me on the team.
are you above number rank 75?
I changed it to a lower number when I tested it.
hmm
I know why it did not work, it was my mistake. I left this in somehow... playerStats[player] = leaderstats
okay