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

Tried to use GetRoleInGroup, what did I do wrong?

Asked by 5 years ago
Edited 5 years ago
game.Players.PlayerAdded:Connect(function(player)
 local Rank = player:GetRoleInGroup(4937707)
if Rank == (150) then
    print("test")
end
end)

It doesn't print anything on my screen.

0
perhaps try printing the Rank outside the if statement..? InfiniteYield 41 — 5y
0
Idk.. Neither of GetRoleInGroup or GetRankInGroup worked.. fortesss7 40 — 5y

2 answers

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

Maybe this could work?

game.Players.PlayerAdded:Connect(function(player)
    local Rank = player:GetRankInGroup(4937707)
    print(Rank)
    if Rank == 150 then
        print("test")
    end
    print("2")
end)

you can remove the print statements i just used it to get info. it worked for a random group i was in / you just needed to remove the brackets around 150

or you could try:

game.Players.PlayerAdded:Connect(function(player)
    local Rank = player:GetRoleInGroup(4937707)
    print(Rank)
    if Rank == "ROLENAME" then
        print("test")
    end
    print("2")
end)
Ad
Log in to vote
0
Answered by 5 years ago
game.Players.PlayerAdded:Connect(function(player)
 local Rank = player:GetRankInGroup(4937707)
if Rank == (150) then
    print("test")
end
end)

You were using the wrong function, use GetRankInGroup not GetRoleInGroup.

0
Still not working.. fortesss7 40 — 5y

Answer this question