I've been wondering how to do this forever, it seams so easy, but I just can't figure it out!
All I need to know is how can I see if the player is multiple ranks, so if the players group rank is 2 but I want to allow 1 and 2 to do the function how can I do that. (other then elseif)
Please help! Thanks. -Tyler
I whipped up a simple script that gets the player's rank in a group once they join the game.
I tested it out and it should work just fine.
1 | local groupid = 4110331 |
2 |
3 | game.Players.PlayerAdded:Connect( function (player) |
4 | local rank = player:GetRankInGroup(groupid) |
5 | print (rank) |
6 | --insert what you want to do with the rank here |
7 | end ) |
Your question is malformulated but I'm guessing you mean every rank above a certain one can run the same function?
1 | local groupId = 7351851 |
2 |
3 | game.Players.PlayerAdded:Connect( function (plr) |
4 | if plr:GetRankInGroup(groupId) > = 5 then |
5 | --Runs only for users with the RankId 5+ in the group 7351851 |
6 | end |
7 | end ) |
and to get a player's rank name would be GetRoleInGroup(groupId)
1 | local groupId = 7351851 |
2 |
3 | game.Players.PlayerAdded:Connect( function (plr) |
4 | print (plr:GetRoleInGroup( 7351851 )) |
5 | if plr:GetRankInGroup(groupId) > = 5 then |
6 | --Runs only for users with the RankId 5+ in the group 7351851 |
7 | end |
8 | end ) |
https://developer.roblox.com/en-us/api-reference/function/Player/GetRankInGroup