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

How do I get a Player's group rank and compare it?

Asked by 9 years ago

What I would like to do is find if the player in which clicked the button is in the group AND is higher than a certain rank id. I just cant do the Rank ID part. Any ideas of fixing the following bracketed section?

local a = script.Parent.Parent.Play.Anthem

function OnClicked(player)
    if player:IsInGroup(1152346) and[ player:GetRoleInGroup(1152346) >= 50 ]then
    a:Stop()
    wait()
    end
end

script.Parent.ClickDetector.MouseClick:connect(OnClicked)

1 answer

Log in to vote
1
Answered by
RedCombee 585 Moderation Voter
9 years ago

I believe the function used is 'GetRankInGroup', not 'GetRoleInGroup'.

if player:IsInGroup(1152346) and player:GetRankInGroup(1152346) >= 50 then
1
The first half of that conditional is unnecessary: GetRankInGroup returns `0` for non-members. adark 5487 — 9y
Ad

Answer this question