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.
local groupid = 4110331 game.Players.PlayerAdded:Connect(function(player) local rank = player:GetRankInGroup(groupid) print(rank) --insert what you want to do with the rank here end)
Your question is malformulated but I'm guessing you mean every rank above a certain one can run the same function?
local groupId = 7351851 game.Players.PlayerAdded:Connect(function(plr) if plr:GetRankInGroup(groupId) >= 5 then --Runs only for users with the RankId 5+ in the group 7351851 end end)
and to get a player's rank name would be GetRoleInGroup(groupId)
local groupId = 7351851 game.Players.PlayerAdded:Connect(function(plr) print(plr:GetRoleInGroup(7351851)) if plr:GetRankInGroup(groupId) >= 5 then --Runs only for users with the RankId 5+ in the group 7351851 end end)
https://developer.roblox.com/en-us/api-reference/function/Player/GetRankInGroup