#Group rank checker

1 messages · Page 1 of 1 (latest)

gusty light
#

How can I make a script that checks for a persons group rank, and if it's not high enough display a GUI frame, doesn't execute a remote event to change teams and doesn't change the UI?

foggy viper
# gusty light How can I make a script that checks for a persons group rank, and if it's not hi...

you can check using the method Player:GetRankInGroup(groupId)

like so:

local RemoteEvent = game.ReplicatedStorage.RemoteEvent
local groupId = 0
local threshold = 100 -- minimum rank in group required

local function CheckRank(Player: Player): ()
if Player:GetRankInGroup(groupId) >= threshold then -- if the player meets or exceeds the threshold
  RemoteEvent:FireClient(Player) -- fire the remote event
 end
end

for i,plr in pairs(game.Players:GetChildren()) do
 CheckRank(plr)
end

game.Players.PlayerAdded:Connect(CheckRank)

sorry if it's not well-formatted, typing on a buggy phone keyboard is not optimal lol

gusty light
#

lol

gusty light
#

you forgot two thirds of it

foggy viper
gusty light
#

its a remote event to change teama

foggy viper
#

also just put the gui frame code under the RemoteEvent:FireClient(player) in CheckRank()
i didnt include it cuz i thought that was already part of the remote event invocation code