✓ Accepted answer
So what I would do is create a Dictionary (which is basically an array but each index [or value] is assigned a value).
Let me demonstrate:
local Player = game.Players.LocalPlayer;
local dictionary = {
Admin1 = true,
Admin2 = true
};
print(dictionary["Admin1"]);
Why this is better is because now, you can set different people to have different "staff" levels.
local Player = game.Players.LocalPlayer;
local dictionary = {
Username1 = "Administrator",
Username2 = "Moderator"
};
print(dictionary["Username1"]);
So, how do you implement this into your script?
local Player = game.Players.LocalPlayer;
script.Parent.Visible = false;
local Admins = {
Sadwowow21 = true,
};
if Admins[Player.Name] then
script.Parent.Visible = true;
end
If you further wanted to add more and have it only show for Administrators:
local Player = game.Players.LocalPlayer;
script.Parent.Visible = false;
local Admins = {
Sadwowow21 = "Administrator",
TestUser = "Moderator"
};
if Admins[Player.Name] == "Administrator" then
script.Parent.Visible = true;
end
13 comments
thank you, but it isn't showing still
I just tested it, and it did work. Which one are you using? If you don't want to get into dictionaries, I'd recommend looping, as Filipalla answered.
Edit: The reason it's not working is because you need to use a LocalScript. You need to have the LocalScript inside the GUI. Then try again.
ok
I keep getting this warning sign 18:19:28.744 - Players.SadWowow21.PlayerGui.ScreenGui.TextButton.LocalScript:6: attempt to index global 'Player' (a nil value)
ah so you never declared LocalPlayer? Okay, I'll update the answer.
I updated it so it'll work.
oh thx so much
If it worked, can you please mark it as answer? Thanks.
Oof, He Didn't Do That :/ Isn't That Against The Rules? (I'm Not Going To Report Him Or Anything Like That, Just Asking)
I don't know lol.
???
Thanks Sadwowow21.