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
print(V.Name)
end
-- // Errors on line below
print(ReplayVoteResults.Name, ReplayVoteResults.Visible, ReplayVoteResults.Parent.Name)
end
ChangeVisiblity()
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:
print(ReplayGui.Name)
print(ReplayGuiFrame.Name)
ReplayGuiFrame.Visible = true
function FixCamera() -- // Fixes the player's camera
ReplayGuiFrame.Visible = false -- // Only works when called from below, not otherwise
end
FixCamera()
-- // Now, I'm not sure if below works because I can't make it visible, but it doesn't error
ReplayGui.Frame.ClickDetector.MouseButton1Click:Connect(FunctionName)
Let me know if I need to post more, thanks in advance.