To make the GUI visible for only group members, make a script in ServerScriptService. Then, hook up a PlayerAdded event. Depending on whether or not ResetOnSpawn of the GUI is true or not, you may need to add a CharacterAdded event. Though for my explanation, I’ll assume ResetOnSpawn is false, as it should be in most cases (from my experience).
Whenever the function runs (player enters), you want to check if the player is in the group. To do this, use the GetGroupsAsync function of GroupService to get an array of the player’s groups. Use a for loop to look through each of the groups, and compare the ID of each of them to your group ID. If the group ID matches, check if the rank is greater than 0. If it is, the player is in the group. If you don’t find the group in the array, that means the player is not in the group.
Though this is more work than just using the methods under the Player object, it provides more up-to-date information as the methods under the Player object cache.
Due to the above method being way more work than it needs to be, I took out time to make an ExtendedGroupService module containing two functions inside it which function similarly to the old methods under the Player object.
If you choose to use the module to make the process quicker, here’s an example of it being used (with the module under ReplicatedStorage, and the Gui inside the server script):
local GroupId = 0 --Your group's ID
local GroupGui = script:WaitForChild("NameOfYourGui")
local PlayersService = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ExtendedGroupService = require(ReplicatedStorage:WaitForChild("ExtendedGroupService"))
local function PlayerEntered(Player)
--Check if the player is in the group
local RankInGroup = ExtendedGroupService:GetUserRankInGroup(Player.UserId, GroupId)
if RankInGroup > 0 then
--Player is in group, give them a clone of the GUI
local PlayerGui = Player:WaitForChild("PlayerGui")
GroupGui:Clone().Parent = PlayerGui
--Run function for new players and players who are already in the game before the script reaches here
local Players = PlayersService:GetPlayers()
for i = 1, #Players do