Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can someone Explane to me how to use GetRankInGroup()?

am trying to make a UI show only if a play is special Role in the group but I dont know how GetRankInGroup() work can someone explane

2 answers

✓ Accepted answer

So :GetRankInGroup() is getting a rank number. So if you go into a group, and click onto a rank, It would have a rank number. That is what :GetRankInGroup() is getting.

local groupID = "Your groupID would go here"

game.Players.PlayerAdded:Connect(function(player)
	if player:GetRankInGroup(groupID) => 5 then 
		--If the players rank number is above 5, it runs code here.
	end
end)

So if the players rank number in the group is equal to or above 5, then it executes the code in the If statement.

If you want to get the role in the group, you can use :GetRoleInGroup(groupID)

I hope this helps you out. If you're still stuck. Comment on this or this [http://developer.roblox.com/en-us/api-reference/function/Player/GetRankInGroup]

To Use GetRankInGroup() You Would Have To Have Something To Change For It Like A Text Or Value, For Example:

script.Parent.Text = plr:GetRankInGroup(RankID)

The Text Would Change To There Rank name In The Group With The GroupID You Can Also Use It As A IF Statement

if plr:GetRankInGroup(RankID) == "Rank" then

3 comments

0

Thankyou but when we doing If plr:GetRankInGroup(RankId) == "Rank" then where do we put theGroup ID

0

I am pretty sure you'd make a variable called "Group", although I am not sure since I have never really needed to use this / wanted to learn it. (i know i am lazy)

1

GetRankInGroup() will return a number, which will cause error at the second script

This discussion is preserved as it was. New answers, comments, and votes are closed.