Hi!
I was in the middle of scripting my game/testing it for any bugs & errors, of-course I get greeted with an error.
I was hoping one of you could help me resolve this issue.
Here is the error:
And here is the script:
local Players = game:GetService("Players")
local groupId = 7033620
Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder", Player)
Leaderstats.Name = "leaderstats"
local RankText = Instance.new("StringValue", Leaderstats)
RankText.Name = "Rank"
local Rank = game.Players:GetRoleInGroup(groupId)
RankText.Value = Rank
end)
Thanks,
Oreo
HayHay
2
I don’t know… it looks normal. I’ll look into it.
Noah
3
local Players = game:GetService("Players")
local groupId = 7033620
Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder", Player)
Leaderstats.Name = "leaderstats"
local RankText = Instance.new("StringValue", Leaderstats)
RankText.Name = "Rank"
local Rank = game.Players:GetRoleInGroup(groupId)
RankText.Value = Rank
end)
local Rank = game.Players:GetRoleInGroup(groupId)
This line is impossible: game.Players is just a directory in your game essentially.

I think you meant to write:
player:GetRoleInGroup(groupId)
1 Like
Thanks! I’ll give it a try tomorrow.
I believe you want this:
local Players = game:GetService("Players")
local groupId = 7033620
Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder", Player)
Leaderstats.Name = "leaderstats"
local RankText = Instance.new("StringValue", Leaderstats)
RankText.Name = "Rank"
local Rank = Player:GetRoleInGroup(groupId)
RankText.Value = Rank
end)
You were referring to the player service, not the singular player! Hope this helped you!
1 Like
system
Closed
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.