My GUI apparently doesn't exist even though I am looking directly at it

What do you want to achieve?

I want the change a Frame instance’s visible property to true

What is the issue?

I have set a variable as a Frame instance, only for me to change the Visible property. I wouldn’t have made it into a variable, but it was part of the debugging process.

What solutions have you tried so far?

Okay, to start, I made a ScreenGui and parented it into game.StarterGui. It’s name is ‘ScreenGui’.
I made a few Frames and put them into the ScreenGui. I used a plugin to make the corners rounded. I have since disabled this plugin because I thought it might be causing issues, as I have heard of this before.

Second, I changed the smoothed cornered frames back into regular frames and parented the smoothed frames into the new frames, as to make a nice looking background.

local PlayerGUI = Plr:WaitForChild("PlayerGui") -- // PlayerGui

local ReplayGui = PlayerGUI:WaitForChild("Replays") -- // The ScreenGUI that I'm having issues with
local ReplayGuiFrame = ReplayGui:WaitForChild("Frame") -- // The frame I'm having issues with
local ReplayButtonDisplay = ReplayGuiFrame:WaitForChild("TextDisplay")

function ChangeVisiblity()
	ReplayGuiFrame.Visible = true
	ReplayVoteResults.Visible = true
	ReplayButtonDisplay.Text = "Skip replay"
	-- // Added for loop to make sure the ScreenGui is where it supposed to be. It is.
    for I, V in pairs(PlayerGUI:GetChildren()) do 
        -- // Errors on line below
	print(ReplayVoteResults.Name, ReplayVoteResults.Visible, ReplayVoteResults.Parent.Name)


This is the error: Players.Player1.PlayerScripts.ClientMaster:304: attempt to index nil with 'Name'

It’s important to note that the Frame does NOT become visible before the error.

I also have things outside of this function that function properly such as:

ReplayGuiFrame.Visible = true

function FixCamera() -- // Fixes the player's camera	
	ReplayGuiFrame.Visible = false -- // Only works when called from below, not otherwise


-- // Now, I'm not sure if below works because I can't make it visible, but it doesn't error

Let me know if I need to post more, thanks in advance.

1 Like

I’m going to keep this post up as a reminder to keep special track of all your ScreenGuis ResetOnSpawn property. The issue in my code was that the variables were set outside of the function and the ScreenGui had been reset since they were defined.

But man I feel dumb.

1 Like