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

IsInGroup is not a valid member of Humanoid for group gui only certain rank can see?

Asked by 5 years ago
Edited 5 years ago

I am trying to make a GUI only a certain rank of my group can see. I have a LocalScript, but Roblox isn't recognizing Humanoid:IsInGroup(groupId)

local Humanoid = script.Parent:WaitForChild("Humanoid")

local groupId = 4274644
local requiredRank = 250

if Humanoid:IsInGroup(groupId) and Humanoid:GetRoleInGroup(groupId) >= requiredRank then
    game.StarterGui.StaffTeleport.Enabled=true
                    -- do something.
end

When I press test or even play, the GUI is seen in PlayerGui, but it doesn't disappear for people not in my group.

I put the LocalScript in the StarterCharacterScripts. I'm not sure if that's the right spot to put it though.

Thank you

1 answer

Log in to vote
0
Answered by
piRadians 297 Moderation Voter
5 years ago

You need to define what player is. You did not in this case. Put this in the first or second line of your code:

local player = game.Players.LocalPlayer

Final Product:

local Humanoid = script.Parent:WaitForChild("Humanoid")
local  player = game.Players.LocalPlayer
local groupId = 4274644
local requiredRank = 250

if player:IsInGroup(groupId) and player:GetRoleInGroup(groupId) >= requiredRank then
    game.StarterGui.StaffTeleport.Enabled=true                  
end

0
This removed the errors but the gui doesn't show up :/ oddjjctiger1 9 — 5y
Ad

Answer this question