Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

1 comment

0

This removed the errors but the gui doesn't show up :/

This discussion is preserved as it was. New answers, comments, and votes are closed.