Not a vlid member of PlayerGui even tough it is

Hi guys, I am trying to make it so my GUI becomes visible when the button is clicked but it gives me the error, " Feedback is not a valid member of PlayerGui “Players.A0RK0.PlayerGui”, I made sure it is here is my script,

local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local feedbackFrame = playerGui.Feedback.Background

script.Parent.MouseButton1Down:Connect(function()
   feedbackFrame.Visible = true
end)

image

Where did you put your script?

image

So, it is in FeedBack ScreenGui?

No it is in another gui called InteractiveGUI

Try to use script.Parent.Parent… etc to StarterGui. Then StarterGui:WaitForChild(“Feedback”):WaitForChild(“Background”)
Or try to modify your script by editing:

local feedbackFrame = playerGui:WaitForChild("Feedback"):WaitForChild("Background")

As it requires some time to clone UI object from starter gui.

None of them fixed it I tried all 3

It’s quite strange situation, because I reproduce this situation and everythings works perfect.

The only idea I have is to force changing ScreenGui parent propery. For example, I put it in replicatedStorage and connected to it.

local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local RS = game:GetService("ReplicatedStorage")
local gui = RS:WaitForChild("Feedback")
local feedbackFrame = gui.Background
gui.Parent = playerGui

script.Parent.MouseButton1Down:Connect(function()
	feedbackFrame.Visible = true
end)

But you can also try without RS. For example, connect to Feedback with script.Parent.Parent… and change its parent property to playerGui.

local feedback = script.Parent.Parent.Parent.Parent:WaitForChild("Feedback")
feedback.Parent = playerGui

If it isn’t work, I have no idea.

Will try that thanks (characters)

game.Players.LocalPlayer.PlayerGui is guaranteed not to be nil, but the GUIs within it are not.

Try this:

local playerGui = player.PlayerGui
local feedbackFrame = playerGui:WaitForChild("Feedback").Background

Descendants of the GUI that are parented there in Studio don’t need to be waited for, either.

insted of waiting for the playerGui wait for the FeedBack Gui because maybe the script checks for it before it is loaded

Ah I think that solved it thanks a lot!

StarterGui and PlayerGui isn’t the same

local feedbackFrame = playerGui:WaitForChild('Feedback').Background

Nevermind that did not solve it either

I tried that before and didn’t change anything

Instead of waiting for PlayerGui, wait for the contents inside your PlayerGui, for example:

You don’t have to WaitForChild on PlayerGui, it’s always there and will not be nil, instead just do:
local playerGui = player.PlayerGui


On this line, use :WaitForChild on Feedback:
local feedbackFrame = playerGui:WaitForChild("Feedback").Background

1 Like

Thank you very much :smiley: that worked perfectly

1 Like