Help with text not displaying but with no error shown in output

So I’m making this menu Gui, it works but it’s not finished, the Play button and Credit button work, but the text i want to be shown won’t show.
Video:
robloxapp-20220131-1813354.wmv (1.3 MB)


Code:

local BackButton = game.StarterGui.ScreenGui.MenuFrame.BackButton

local PlayButton = game.StarterGui.ScreenGui.MenuFrame.PlayButton

local CreditsButton = script.Parent

local HelpButton = game.StarterGui.ScreenGui.MenuFrame.HelpButton

local CreditsText1 = game.StarterGui.ScreenGui.MenuFrame.CreditsButton.CreditsText2

local CreditsText2 = game.StarterGui.ScreenGui.MenuFrame.CreditsButton.CreditsText2

local MenuFrame = script.Parent.Parent

local Players = game:GetService("Players")

local player = game.Players.LocalPlayer

local PlayerGui = player:WaitForChild("PlayerGui")

local ScreenGui = PlayerGui:WaitForChild("ScreenGui")

CreditsButton.MouseButton1Click:Connect(function()

ScreenGui.MenuFrame.PlayButton.Visible = false

ScreenGui.MenuFrame.HelpButton.Visible = false

ScreenGui.MenuFrame.CreditsButton.Visible = false

ScreenGui.MenuFrame.BackButton.Visible = true

ScreenGui.MenuFrame.CreditsButton.CreditsText1.Visible = true

ScreenGui.MenuFrame.CreditsButton.CreditsText1.Visible = true

end)

If anyone can help me with this, I’d appreciate it.

1 Like

It seems that on lines 18 and 19 of the image you sent, you do the exact same thing twice. Perhaps on line 19 you were meaning to set the Visibility of CreditText2 to true instead of CreditText1?

Also, you made a similar error when declaring your StarterGui CreditText variables as well. Lines 5 and 6 both reference the same text label.

There are two credit texts so that’s not a mistake, though i think you are right about me falsely defining them in local.
Could you correct that maybe?

Regarding lines 5 and 6, they should have no impact on your current issue- they are StarterGui objects and your problem deals with PlayerGui objects. Modifying StarterGui properties while the client is running should have no impact on those of the PlayerGui.

I still think your problem lies on lines 18 and 19, as you are attempting to set the CreditText1 label to Visible TWICE and not setting the visibility of CreditText2 to true at all. I think if you were to modify lines 18 and 19 to the following code, you would be fine.

ScreenGui.MenuFrame.CreditsButton.CreditsText1.Visible = true ScreenGui.MenuFrame.CreditsButton.CreditsText2.Visible = true

Hopefully this helps. If not, let me know and we can further discuss.

Did not work, i’m going to try some testing in another studio to see if this can somewhat work

local CreditsButton = script.Parent
local MenuFrame = CreditsButton.Parent

CreditsButton.MouseButton1Click:Connect(function()
	MenuFrame.PlayButton.Visible = false
	MenuFrame.HelpButton.Visible = false
	MenuFrame.CreditsButton.Visible = false
	MenuFrame.BackButton.Visible = true
	MenuFrame.CreditsButton.CreditsText1.Visible = true
	MenuFrame.CreditsButton.CreditsText2.Visible = true
end)

From now on please write all of your gui scripts in the way I have done above. It’s a lot more readable and doesn’t rely on you fetching the client’s player instance and indexing their “PlayerGui” folder in order to reference the GuiObject instances you wish to script functionality to. Instead, simply reference GuiObjects as parents/children of one another in respect to the local script’s location inside the ScreenGui instance.

I actually managed to fix it, it was just appearing in the wrong location on the screen, far from players view