PlayerGUI error getting Frame

Hi,

I am trying to get the QuestFrame from a localscript but getting the error below but don’t know why.

Quests is not a valid member of PlayerGui “Players.CanterCrow.PlayerGui”

local Players = game:GetService("Players")
local client = Players.LocalPlayer
local frame = client.PlayerGui.Quests.QuestFrame

QuestFrame

Thanks

You could just do

local frame = script.Parent.QuestFrame

to get the frame

you should use the WaitForChild function because the script is loaded before the children of the PlayerGui

local Players = game:GetService("Players")
local client = Players.LocalPlayer
local Quests = client.PlayerGui:WaitForChild("Quests")
local frame = Quests:WaitForChild("QuestFrame")
3 Likes

Try getting the frame in StarterGui, it automatically changes or sets it with PlayerGui

They don’t want to get the StarterGui. They want to get the PlayerGui so that it can change while on their screen.

Yes, but if you change the GUI while on StarterGui, it does it automatically to the Player and nobody else unless you want it to.

I’ve had this same error before,

Add in a WaitForChild here:

local frame = client.PlayerGui:WaitForChild(“Quests”).QuestFrame

It may change when the player respawns, but it will not change their current player gui. If you really want to prove to me that it would work the way you’re saying, go into studio and test it. It won’t work.

I’m not sure if you ever heard of this amazing discovery:

Screenshot (45)

ResetOnSpawn

I have tested it, i use it in my game, it works perfectly.

1 Like