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?
So first of all you cannot index local player in a server script only a local script.
So second of all we need to set up our Variable and our function as shown below!
local GroupID = IDHERE -- Change "IDHERE" To your group ID game.Players.PlayerAdded:Connect(function(Player) end)
So Now we have that done now we need to create our leaderstats folder which is required to display leaderstats ingame! along with that we will make our role leaderstat in the process!
local GroupID = IDHERE game.Players.PlayerAdded:Connect(function(Player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = Player local Role = Instance.new("StringValue") Role.Name = "Role" Role.Value = Player:GetRoleInGroup(GroupID) Role.Parent = leaderstats end)
Hope this helped you!