Need help with Screengui.Enabled

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I want to check if the screengui.Enabled is false.

  2. What is the issue?
    It doesn’t seem to detect the boolean value even though it is false.

  3. 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.

Have you tried doing:

if not screengui.Enabled then

?

Also, use either:

  • camelCase
  • PascalCase
  • Snake_Case
  • LOUD_SNAKE_CASE

to write code, as writing:
thisismyguiineedtodisable
Isn’t readable, instead:
thisIsMyGuiINeedToDisable
Is readable

1 Like

Yes, I tried that. I also tried doing

if screenGui.Enabled then

It detects it, but it doesn’t seem to detect if it is false.

Can you please provide F9 Console. Please define if the script is a Module, ServerScript, LocalScript, and its location :slight_smile:

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

1 Like

Do you still need help or was the issue resolved?

1 Like

Hey, it has been already resolved. Thank you for trying to help!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.