Why is my Menu GUI not working? I am making a basic menu and just started on it. When I test it the buttons that I am using to make fames visible and close the menu are not working at all.
This is what I have atm.
local Frame = game.StarterGui.ScreenGui.Frame
local Frame2 = game.StarterGui.ScreenGui.Frame2
local Play = game.StarterGui.ScreenGui.Frame.Play
local Teams = game.StarterGui.ScreenGui.Frame.Teams
local Close = game.StarterGui.ScreenGui.Frame2.close
local Jedi = game.StarterGui.ScreenGui.Frame2.jedi
local Sith = game.StarterGui.ScreenGui.Frame2.sith
Frame.Visible = true
Frame2.Visible = true
Play.MouseButton1Click:Connect(function()
Frame.Visible = false
Frame2.Visible = false
end)
Teams.MouseButton1Click:Connect(function()
Frame2.Visible = true
end)
Close.MouseButton1Click:Connect(function()
Frame2.Visible = false
end)
I have never made a menu before so please forgive me if I made some obvious mistake.
The problem is that you’re hooking events to the StarterGui version of your menu. StarterGui elements are not rendered to the visitor but rather serve as a container for which Guis are copied from to the player. You’ll need to access the LocalPlayer’s PlayerGui to make changes to the Gui that visitor actually see.
No, you don’t. All Gui elements inside of StarterGui gets copied over to a Folder under the Player called PlayerGui. All you need to do to fix your script is change the StarterGui to PlayerGui.
local Player = game.Players.LocalPlayer
local PlayerGui = Player.PlayerGui
local ScreenGui = PlayerGui.ScreenGui
local Frame = ScreenGui.Frame
...etc..