I am getting problem with :GetRoleInGroup()
. The problem is that every time I check if the group role is the same what I am looking for it, but if the statement denials it. The role name is my username mohamedn88880, I tried to print it and it gives the exact name mohamedn88880 which made me confused.
Script:
local function checkGiveStaffMemberHisPanel(plrInstance)
print("Check if "..plrInstance.Name.." a staff member")
print(plrInstance:GetRoleInGroup(groupID))
if success and playerRole then
if plrInstance:GetRoleInGroup(groupID) == "mohamedn88880" or plrInstance:GetRoleInGroup(groupID) == "NotMichaelRBLX" then
GivePanel("OwnerPanel", players:FindFirstChild(plrInstance.Name))
end
if playerRole.role == "admin" then
GivePanel("AdminPanel", players:FindFirstChild(plrInstance.Name))
end
if playerRole.role == "moderator" then
GivePanel("ModPanel", players:FindFirstChild(plrInstance.Name))
end
else
print(plrInstance.Name.." isn't a staff memeber")
end
end
Output: Ignore Loaded
Can we see where the success and player role variables are defined?
1 Like
Ignore them, I just removed some parts of the script I put what do you need to know, only.
I can’t ignore them because it’s printing that you aren’t a staff member because one or both of those variables are false.
Why are you choosing to use GetRoleInGroup
as opposed to GetRankInGroup
as surely this would be far more reliable as you would only have to compare numerical values as opposed to strings which can help make it all a bit less confusing. GetRoleInGroup
is only really ideal for things like overhead GUIs and leaderboard rank displays and shouldn’t be used for checking someones rank in a group.
A script which would preform the same functionality and should work could look something like this:
local function checkGiveStaffMemberHisPanel(plr)
if plr:GetRankInGroup(GroupId)==255 then -- replace 255 with the rank number
Givepannel()
elseif plr:GetRankInGroup(GroupId)==5 then
Givepannel()
end
end
I have also used an elseif statement in the above code just so that it is a bit neater instead of having individual if statements for each panel check
Hope this is able to somewhat help
2 Likes