peter
1
Hello!
I am wondering how I would go about making my UI only visible to ranks 2+ in the group?
Thanks,
@peter
peter
2
All the scripts I have tried do not work.
Noah
3
Have you got any examples of scripts you’ve tried?
peter
4
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
Noah
5
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
peter
6
And that makes it visible to group members above that rank too?
Noah
7
No, only to that one individual rank.
peter
8
Alright, thank you. I’ll try that.
peter
9
It doesn’t work. I tried it first with what you gave me (didn’t edit id’s) and it still came up.
Noah
10
What type of script is this, do you have any errors in logs?
peter
11
It’s a normal script, child of the UI. I’ll check my logs.
Noah
13
Normal scripts aren’t locally based, it will need to be a local script. 
peter
14
Alright, I’ll do that right now!
peter
15
It worked!! Thank you so much cookie!
1 Like
peter
16
Could I slightly alter the script with:
local rank >= 4
Noah
17
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
peter
18
Thank you! And that makes it so that users over that rank can see the UI?
Noah
19
I think so, if it doesn’t reverse the operator.
1 Like
system
Closed
20
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.