Issues With GUI, Again

Can someone review this code? The idea here is that once the button is clicked, it hides the menu gui and makes visible the player information guis (that I made)
image
image
However, the PlayerStats (the gui I need to make visible) doesn’t actually become visible. In the Properties window the ‘Visible’ property is checked, however the gui itself isn’t visible. Any help appreciated. Thanks.

1 Like

You are referencing StarterGui, you should instead reference the PlayerGui of the player.

1 Like
local pim = script.Parent.Parent.Parent.Parent.PlayerInformationMenus

script.Parent.MouseButton1Click:Connect(function()
    pim.PlayerStats.Visible = true
    script.Parent.Parent.Parent.Enabled = false
end)

like what @RMofSBI said, it’s currently referencing StarterGui which clones all GUI to PlayerGui and they won’t get updated, instead of doing that
do the following

local PlayerSV = game:GetService("Players")
local PlayerGui = PlayerSV.LocalPlayer:WaitForChild("PlayerGui")

local StartGUI = PlayerGui.Start
local pim = PlayerGui.PlayerInformationMenus
local BUTTON = script.Parent

BUTTON.MouseButton1Click:Connect(function()
       pim.PlayerStats.Visible = true
       StartGUI.Enabled = false
end

To make this efficient instead of parenting in function, i decided to add variables so it would look a lot cleaner

though this was written in mobile, I’m not sure if it works but give it a try atleast.

It didn’t end up working. Is there another solution?
Edit: there’s also no output…

I changed the script a little, however the output says

  15:18:59.180  PlayerInformationMenus is not a valid member of PlayerGui "Players.MicrosoftDeveloper1.PlayerGui"  -  Client - LocalScript:1

image
What could be happening here?

Use PlayerGui:WaitForChild(“PlayerInformationMenus”)

1 Like

Still nothing… What could be happening here?

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.Parent.Parent:WaitForChild("PlayerStats").Visible = true
script.Parent.Parent.Parent.Parent.Enabled = false
end)
  1. Sometimes game.StarterGui… dont work, so use script.Parent…
  2. You forgott to add another Parent. Your three Parent ends in the Frame, Frame dont have a Enabled Button, if you want to close Holder then use script.Parent.Parent.Parent.Visible = false instead of script.Parent.Parent.Parent.Parent.Enabled = false, if you want to make the Gui close then just copy the script over me

Doesn’t this work?

local plr = game:GetService("Players").LocalPlayer
local PlayerGui = plr.PlayerGui
local ScreenGui = PlayerGui:WaitForChild("PlayerInformationMenus")

No, it doesn’t work. And I can’t do what @Pegagittt said to do because its a separate ScreenGUI it’s not a frame inside of the parent ScreenGUI.

Trying to understand what is happening here, let me know if this works, place it in the same script as your previous one:

local player = game:GetService("Players").LocalPlayer
local pim = player:WaitForChild("PlayerGui"):WaitForChild("PlayerInformationMenus")
local StartMenu = player:WaitForChild("PlayerGui"):WaitForChild("Start")

script.Parent.MouseButton1Click:Connect(function()
	pim.Enabled = true
	pim.PlayerStats.Visible = true
	StartMenu.Enabled = false
end)

What you mean u cant do what i said can u explain better where the Script is located, can u draw it in the Picture