Hello fellow people!
I need some help in finding out why my script will not work properly. Here is this module to disable/enable guis:
--//Services and Player
local PS = game:GetService("Players")
local Player = PS.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
--//Module Functions
local Functions = {}
local ActiveGuis = {}
function Functions:DisableActiveGuis(ExclusionTable)
for i, Gui in pairs(PlayerGui:GetDescendants()) do
if Gui:IsA("ScreenGui") then
--Make so that if gui is part of exclusion then leave it else disable and add gui to ArtiveGuis table
if ExclusionTable then
if table.find(ExclusionTable, Gui) then
print("Exclusion: ", Gui)
continue
end
end
if Gui.Enabled == true then
Gui.Enabled = false
print("Disabled: ", Gui)
table.insert(ActiveGuis, Gui)
end
end
end
end
function Functions:EnableInactiveGuis()
for i,Gui in ipairs(ActiveGuis) do
if Gui:IsA("ScreenGui") then
Gui.Enabled = true
print(Gui, "REMOVED")
table.remove(ActiveGuis, i)
else
warn("What", Gui)
end
end
print(ActiveGuis)
end
return Functions
Now clearly it looks fine right? NO! For some reason some guis just don’t get enabled again when the second function is called. Here is a output ss:
Maybe something to do with the gui itself?
Thanks!