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.
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