I am trying to fire a function when the ScreenGui becomes enabled from not enabled
I tried this script inside it and it will print “A” but not “function fired”
why is it not working?
local ScreenGui = script.Parent.Parent.Parent
wait(3)
ScreenGui.Enabled = true
print("A")
ScreenGui.Changed:Connect(function(Enabled)
if ScreenGui.Enabled == true then
--Stuff that should run
print("Function fired")
end
end)
From not enabled to enabled, are you talking about when you’re enabling it in the script?
If so, try putting the connection above when you’re enabling it, or better yet, above the wait.
local ScreenGui = script.Parent.Parent.Parent
ScreenGui.Changed:Connect(function(Enabled)
if ScreenGui.Enabled == true then
--Stuff that should run
print("Function fired")
end
end)
wait(3)
ScreenGui.Enabled = true
print("A")