Hello.
I am trying to make a script so that only players in my group, with a certain rank can see the SurfaceGUI.
Why isn’t this script working?


Hello.
I am trying to make a script so that only players in my group, with a certain rank can see the SurfaceGUI.
Why isn’t this script working?


LocalScripts don’t run inside of parts. Instead, put the LocalScript in StarterPlayerScripts, from there, we will access the SurfaceGui, like this:
local player = game.Players.LocalPlayer
local groupId = 11390942
local minRank = 3
local board = workspace.MenuBoard -- Change the path if needed
local isMinRank = player:GetRankInGroup(groupId) >= minRank
board.SurfaceGui.Enabled = not isMinRank
Also, your script disabled the GUI when a player had a certain rank, if this wasn’t your intention, just remove the “not” at “not isMinRank”.
why don’t u try using a PlayerAdded function?
local groupid = 11390942
local minrank = 3
game.Players.PlayerAdded:Connect(function(player)
local rank = player:GetRankInGroup(groupid)
if rank >= minrank then
script.Parent.Enabled = true
else
script.Parent.Enabled = false
end
end)
and make sure that the frame is enabled…