i’m trying to make a script where a GUI will only appear on a players screen upon joining the game only if you are a certain rank in a certain group. does anyone know how i can make this possible?
1 Like
In a local script, you do this:
local rank = game.Players.LocalPlayer:GetRankInGroup(groupId)
if rank == 255 then —owner rank
else
— if this is a gui, then having it sit in your player’s player gui is kind of useless
task.wait(0.5)
gui:Destroy()
end
The group Id is just that consecutive set of numbers in the link of your group.
Also, it’s very unnecessary to be asking this on a dev forum post, when you can easily look this up on YouTube or a web browser. Please, do your research next time.
@RefusalMan Already sent an solution but heres one with instructions!
put this script inside of the ScreenGui that you want and change the GroupId 
local Players = game:GetService("Players") --// game.Players
local LocalPlayer = Players.LocalPlayer --// Getting the LocalPlayer from players
local Gui = script.Parent --// Make sure that the parent of this script is an "ScreenGui"
local GroupID = 9175107 --// Put here the GroupID you want
local RequiredRank = 255 --// 255 is the highest rank on a group (owner)
if LocalPlayer:GetRankInGroup(GroupID) >= RequiredRank then --// Checking if Players rank in group is higher or equal than "RequiredRank"
Gui.Enabled = true --// Enabling the "ScreenGui"
else
Gui.Enabled = false --// Disabling the "ScreenGui"
task.delay(0.25, function() --// Waits 0.25 for it to load
Gui:Destroy() --// After Deletes it
end)
end
I suggest using pcalls alongside with GetRankInGroup. To prevent issues.