I tried to think of this on my own and i got a solution but i have a small problem!
game.Players.PlayerAdded:Connect(function(player)
local leaderstats= Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Ranking = Instance.new("StringValue")
Ranking.Name = "Rank"
Ranking.Value = game.Players.LocalPlayer:GetRoleInGroup(2580112)
Ranking.Parent = leaderstats
end)
In the Output it's says an Error ( Workspace.Script:8: attempt to index field 'LocalPlayer' (a nil value) ) Why? I don't understand why it's a Nil value.
Can you help me out please?

1 comment
Likely because you're doing this in a SERVER script. The LOCAL player is available only in LOCAL scripts.