I want to make it so that my script changes the group it gets the ranks from when a player switches teams. For example, if I was on the team "Really Black" and it shows my rank in the leaderboard for group A and I switch to the "Really Red" team, I want to change my script so that instead of getting my rank from group A, it gets it from group B instead. How would I do that? Here is my code so far:
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("IntValue")
leaderstats.Name = "leaderstats"
leaderstats.Value = 0
local rank = Instance.new("StringValue")
rank.Name = "Rank"
rank.Value = player:GetRoleInGroup(5439395) -- put group id in parentheses
leaderstats.Parent = player
rank.Parent = leaderstats
end)

1 comment
Elaborate on your question, please.