I’m trying to make a tool which has a users group rank on it, I’ve gotten a headshot and a username but I can’t find out how you get a group rank onto it, I only get an error with nil value if I try to do :GetRoleInGroup()
can anyone help?
I’m trying to make a tool which has a users group rank on it, I’ve gotten a headshot and a username but I can’t find out how you get a group rank onto it, I only get an error with nil value if I try to do :GetRoleInGroup()
can anyone help?
If they aren’t in a group with :GetRoleInGroup() being supplemented with a proper group ID, it’ll return nil. Otherwise, it returns their role in that group.
I put a group ID in it yet it still returns nil
Try doing this (Replace all values with your values)
local groupRole = Player:GetRoleInGroup(GROUPID)
script.Parent.Text = groupRole
I’d like to add on that a LocalScript would be better at doing this, as stated in the documentation.
https://developer.roblox.com/en-us/api-reference/function/Player/GetRoleInGroup
Same exact error as I was getting previously
If a player isn’t in said group, it should return “Guest”, not nil…?
Looks like its not a problem of the function, I think Player
is nil in this.
try creating a local script in StarterPlayer
and paste the code below, and run.
print(game.Players.LocalPlayer:GetRoleInGroup(YOURGROUPIDHERE))
let me know what this prints.
Then why does it print both the username and userid if you print game.Players.LocalPlayer and userid
Send a screenshot of what it prints?
what you sent isn’t of any relevance though as I want it to be on a tool textlabel which you cant just do game.Players.LocalPlayer for
Use a remotefunction, and have a localScript return the requested data.
seems legit (this is ingame when i printed it)
LocalPlayer only works in a LocalScript
OK lets try this then:
ServerScriptService
game.Players.PlayerAdded:Connect(function(player)
print(player.Name.."'s Rank in the group is: "..player:GetGroupRank(GROUPIDHERE))
end)
You did the code wrong.
you need to do:
game.Players.PlayerAdded:Connect(function(player) print(player.Name.."'s Rank in the group is: "..player:GetRankInGroup(GROUPIDHERE)) end)
you did “GetGroupRank”