Help With Simple Gui Issue

I don’t know where you’ve learned this, because I’ve been scripting for at least 3 years, lol.

UIs should always be handled on the client. So please stop feeding this guy mis-information. It’s confusing, and doesn’t help anyone.

Do some debugging, ill give you my way

script.Parent.MouseButton1Click:Connect(function()
print("Clicked.")
game.StarterGui:FindFirstChild("Menu").Enabled = true
print("enabled done.")
end

actually on a second thought, i’d do

game.Players.LocalPlayer.PlayerGui:FindFirstChild("Menu").Enabled = true

Okay both @Florentin5434 and @KultDeeri don’t seem to see the basic issue with your code here. And floren is just feeding you wrong practices.

UIs cannot be scripted or managed using game.StarterGui. All UI on player loading is cloned to the playerGui. So you can reference this using

game.Players.LocalPlayer.PlayerGui.YourUI

Your script is working, it’s just not changing the right UI.

The MenuGUI itself is disabled so the menu open button can change the property to enabled once the OpenMenu button is clicked.

I already fixed it like literally right above your comment.

1 Like

Assuming this isn’t in a local script under StarterGui anywhere, you’ll need to define your ScreenGui through the players PlayerGui which can be found under the player instance.

local menu = player.PlayerGui.Menu

script.Parent.Activated:Connect(function()
  menu.Enabled = true
end)

Please note that the only instance that has an activated event that I can think of is a ClickDetector, which only work in workspace & local scripts don’t work in workspace.

Could you try this out?

script.Parent.MouseButton1Click:Connect(function()
print("Clicked.")
game.Players.LocalPlayer.PlayerGui:FindFirstChild("Menu").Enabled = true
print("enabled done.")
end

Are you sure? I’m seeing some YouTube videos and they are doing it in relatively the same method.
image

Can you tell us where your script is located?

script.Parent.MouseButton1Click:Connect(function()
	script.Parent -- Use .Parent and then it opens!
end)

It’s different from your script, as they’re parenting the SCRIPT as a parent to the UI, while you’re trying to reference the UI using game.StarterGui, they’re referencing the parent, and when the UI is cloned to the player, the script is cloned to the player too, and it refernces the parent, so it works fine.

1 Like

Just try my method and see if it works, it’s should definitely work, also show the prints if it didn’t work, as they are used for debug

Okay, @Mysterial_12.

Heres the solution:

-- delete the variable Menu

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Parent.Menu.Enabled = true
end)
1 Like

That would be inefficient, as you can just grab it from the playergui, as if something didn’t load right, problems could happen + you didn’t add a “WaitForChild” or anything.

I know, but were only talking about the visibility, not the errors that may occur

Thank you so much! It works and everything shows up great.

1 Like

No problem!
Have a nice day!

1 Like

Will if that doesn’t matter for you then oh well.