Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I allow specific users to view a frame?

Asked by 10 years ago

This frame is inside a gui and only users that are listed should be able to view it. This script does not work, so what could I do to check if the player is in the Admin table?

Here is my attempt

Admin = {"IntellectualBeing"}

local Frame = script.Parent
if Admin then 
Frame.Visible = true
else
print('You do not have permission to view this!')

end)

1 answer

Log in to vote
1
Answered by
Dummiez 360 Moderation Voter
10 years ago

It's in a table, so it's like you're getting a list of names, use a loop to retrieve the names.

Admin = {"IntellectualBeing"}

local plr = game.Players.LocalPlayer
local Frame = script.Parent

for i = 1, #Admin do
    if plr.Name == Admin[i] then
    Frame.Visible = true
    else
    print('You do not have permission to view this!')
    end
end
0
Oh, okay. I see what I did wrong and I will use the loop when dealing with tables. Thanks for the help! IntellectualBeing 430 — 10y
Ad

Answer this question