How to make a UI visible if player it is on group

Is there a way to make a UI visible if player its on a roblox group and have a certain rank?
Already tried to search on DevForum but i found nothing…

1 Like

Pretty sure it would be:

local groupID = 0

if game.Players.LocalPlayer:IsInGroup(groupID) then
script.Parent.Visible = true
end

(if we concider that theres only 1 ui object and the localscript is inside it)

3 Likes

it works! but what if i want an specific rank to get access to a certain UI?

In addition to what @JustNylo said,

If you want to do that from the server, you could do :

game.Players.PlayerAdded:Connect(function(plr)
  if plr:IsInGroup("ID_HERE") then
     --if you want to clone a UI and only let players that in your group see it
     local UI = script.Parent:Clone()
     UI.Parent = plr.PlayerGui
    --if you want to visible an existing UI
     local Target = plr.PlayerGui["GUI_NAME"]
     if Target then
         Target.Enabled = true
     end
  end
end)
1 Like

You can use GetRankInGroup or GetRoleInGroup,

GetRankInGroup returns numbers.

GetRoleInGroup returns strings.

1 Like
local groupId = 2520541
local rank = 150

if player:GetRankInGroup(groupId) == rank then

end
1 Like

It works! But i dont want to make an UI visible, its just a frame…
image
See that “Group Member” Frame? Inside it theres an TextButton and a Frame.
I need to make that Frame not visible and that TextButton visible (:
(The script that GameMakingDev worked, but i need the certain rank)

1 Like

If you want to make the Frame Visible, then simply do :

game.Players.PlayerAdded:Connect(function(plr)
  if plr:IsInGroup("ID_HERE") then
     --if you want to clone a UI and only let players that in your group see it
     local UI = script.Parent:Clone()
     UI.Parent = plr.PlayerGui
    --if you want to visible an existing UI
     local Target = plr.PlayerGui["GUI_NAME"]
     if Target then
         Target["YOUR_FRAME"].Visible = true
     end
  end
end)
1 Like