I'm heavily confused why my local script won't access PlayerGui

For some reason this script just won’t bother access the following hierarchy to get to the Frame that I want to customise the text of within this remote event. I’m heavily confused why it just spits this error

This gui is in starterplayer and it’s copied to PlayerGui so why can’t I access it? Is it because it’s an OnClientEvent so something messes up or something else?
It errors on the 13th line btw.

-- Services
local replicatedStorage = game:GetService("ReplicatedStorage")
local playerService = game:GetService("Players")
local serverStorage = game:GetService("ServerStorage")

-- Variables
local getRemote = replicatedStorage.Remote_Events.Change_Coin_Gui

getRemote.OnClientEvent:Connect(function()
	print("Got client request")
	
	local getPlayerGui = playerService:FindFirstChild("PlayerGui")
	local getFolder = getPlayerGui:FindFirstChild("Tix_Amount")
	local getTixCounter = getFolder:FindFirstChild("Tix_Counter")
	local getFrame = getTixCounter:FindFirstChild("Frame")
	
	getFrame.TextBox.Text = "Hello :)"
	
end)

I always use :WaitForChild() when accessing GUI’s through local scripts.

1 Like

The thing is all the stuff exists when it’s loaded in. But either way if I do that it gives me an infinite yield.

Edit* Didn’t notice u showed an error, oof is on to something

Is their such a thing as “TextBox” in PlayerGui/Tix_Amount/Tix_Counter/Frame?

Is it named “TextBox” and does that text box have a property named “Text”?

1 Like

Nevermind I fixed the solution myself. It was awful script placement.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.