-- owner and moderator assets owner = {"devSchon","Player1"} moderator = {} if script.Parent.Parent.Name == owner then script.Parent.OwnerAssets.Notifier.Visible = true end
What I'm trying to do is to check if the player's username matches the users in the "owner" table; then make a GUI visible.
Thank you in advance for your help!
Using a for
loop is the best option because you can loop through each individual value within the table and check if it matches.
-- owner and moderator assets owner = {"devSchon","Player1"} moderator = {} for _, player in pairs(owner:GetChildren()) do --Creates a loop, where "player" is the value being iterated upon. if script.Parent.Parent.Name == player then script.Parent.OwnerAssets.Notifier.Visible = true end end
If I helped you, be sure to accept my answer! :D
You simply need to iterate through the table in search for the particular object or value you want to evaluate. You can use any iterator function, which along with a generic for loop would do just what you need.
owner = {"devSchon","Player1"} moderator = {}
for index, value in pairs(owner) do if script.Parent.Parent.Name == value then -- found end end