Hello! I own a bakery and I'm trying to figure out how to make a GUI only visible to a certain rank. This is because I am making a mod call GUI and I don't want guests to be abusing it!
COMMUNITY QUESTION
How can I make a GUI only visible to certain group ranks?
2 answers
You can Access a Player from a LocalScript to get the Player, And Get into the Client with a :GetRankInGroup By searching the Players from the GROUPID.
------------------------------------------
--------------{Variables}-----------------
------------------------------------------
local Players = game.Players.LocalPlayer
local GROUPID = 12345-- type in the group's Roblox Id
local MainFrame = script.Parent.FRAME
-----------------------------------------
-----------------{Code}------------------
-----------------------------------------
if Players:GetRankInGroup(GROUPID) >= 200 then --Minium Group Rank Required
MainFrame.Visible = true
-- The rest of your code
end
gonna be honest bad code pratice coming from sonic dev as an exploiter an easily make the gui visible and run it as usual
the first thing you will want to do is parent the gui to the script you are putting the code in (script should be in server script service or a place exploiters can not reach, you could also parent the script to nil when the player joins so they do not have access to it) and then use this code to parent the gui if they are a certain rank in the group
local plrs= game:GetServce("Players")
local GROUPID = 12345-- type in the group's Roblox Id
local gui = script:WaitForChild(theguiname)
plrs.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(thegroupid) >= 200 then -- you can change this to be a certain number if needed
gui:Clone().Parent = player.PlayerGui
-- extra code if needed
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
