Hello, I am trying to make a white list system, the checks and stuff work well, only problem is when its valid, it will make a for loops through the instance with (:GetDescendants), and it would check the classnames for each particular instance. In this case, it just overrides and ignores the statement, and just continues with enabling the .Visible function. Any ideas?
Error:
Problem:
Code:
script.Parent.MouseButton1Click:Connect(function()
local plr = game.Players.LocalPlayer
local WL = require(script.Parent.Parent:WaitForChild("Panel"):WaitForChild("WL"))
local whitelisted = WL.whitelisted
for i,v in ipairs(whitelisted) do
if plr.UserId == v then
local opened = script.Parent.Parent:WaitForChild("Panel"):WaitForChild("Opened")
if opened == false then
opened = true
else
opened = false
end
if opened == true then
for _, UI in pairs(script.Parent.Parent:WaitForChild("Panel"):GetDescendants()) do
if (UI.ClassName == "TextButton" or "Frame" or "TextLabel") then
UI.Visible = true
end
end
else
for _, UI in pairs(script.Parent.Parent:WaitForChild("Panel"):GetDescendants()) do
if (UI.ClassName == "TextButton" or "Frame" or "TextLabel") then
UI.Visible = false
end
end
end
end
end
end)
Explorer:

