You can write your topic however you want, but you need to answer these questions:
What do you want to achieve?
I want to check if the screengui.Enabled is false.
What is the issue?
It doesn’t seem to detect the boolean value even though it is false.
What solutions have you tried so far?
I went through some posts in the devforum, but I’m still stuck.
local welcomegui = game.Players.LocalPlayer.PlayerGui:WaitForChild("WelcomeGui")
local screengui = game.Players.LocalPlayer.PlayerGui:WaitForChild("ScreenGui")
if screengui.Enabled == false then
print("Screengui!")
end
If it helps, the script is in the StarterPlayerScripts.
You should be checking if the value has changed for not, this will only run once and not run once it changes, in order to have that effect you must use either Changed or GetPropertyChangedSignal for this, in this usage we will use GetPropertyChangedSignal, like this:
screengui:GetPropertyChangedSignal("Enabled"):Connect(function() -- Detects Change from the 'Enabled' property
if not screengui.Enabled then -- if not Enabled
print"Screengui!" --> Screengui!
end
end)
Only LocalScripts and ModuleScripts can run inside StarterPlayerScripts