How to make UI only appear for a certain group rank?

Hello!

I am wondering how I would go about making my UI only visible to ranks 2+ in the group?

Thanks,
@peter

All the scripts I have tried do not work.

Have you got any examples of scripts you’ve tried?

Yes:

local plr = game.Players.LocalPlayer
local group, rank = 2831912, 2 or 3 or 5 or 6 or 255

if plr:GetRankInGroup(group) == rank then
	script.Parent.Visible = true
else
	script.Parent.Parent:Destroy()
end
local plr = game.Players.LocalPlayer
local group = 1
local rank = 4



if plr:GetRankInGroup(group) ~= rank then
	script.Parent.Parent:Destroy()
end

This should work, if this works we can move on to something more advanced.

1 Like

And that makes it visible to group members above that rank too?

No, only to that one individual rank.

Alright, thank you. I’ll try that.

It doesn’t work. I tried it first with what you gave me (didn’t edit id’s) and it still came up.

What type of script is this, do you have any errors in logs?

It’s a normal script, child of the UI. I’ll check my logs.

Normal scripts aren’t locally based, it will need to be a local script. :confused:

Alright, I’ll do that right now!

It worked!! Thank you so much cookie!

1 Like

Could I slightly alter the script with:

local rank >= 4

For sure, I would do that, but:

local plr = game.Players.LocalPlayer
local group = 1
local rank = 4



if plr:GetRankInGroup(group) <= rank then
	script.Parent.Parent:Destroy()
end

Thank you! And that makes it so that users over that rank can see the UI?

I think so, if it doesn’t reverse the operator.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.