Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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]

Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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
0
Thankyou but when we doing If plr:GetRankInGroup(RankId) == "Rank" then where do we put theGroup ID Xx0966xX 41 — 3y
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) EH2019SIT 78 — 3y
1
GetRankInGroup() will return a number, which will cause error at the second script Nguyenlegiahung 1091 — 3y

Answer this question