Why is my GUI not displaying my Value?

I have a gui in my game like a lot of other that displays the amount of a currency you have. I made the script to this a while ago and was updating it and it stopped working. Wondering what the problem is here?


image

Here is the Local Script I am using

local coinsFrame = script.Parent
local coinsAmount = coinsFrame.amount
local plr = game.Players.LocalPlayer
local plrCoins = plr:WaitForChild("leaderstats"):WaitForChild("Coins")
coinsAmount.Text = tostring(plrCoins.Value)
plrCoins.Changed:Connect(function()
	coinsAmount.Text = tostring(plrCoins.Value)
end)

Do you have any errors? Are you referencing your variables correctly?

1 Like

for local coinsAmount = coinsFrame.amount, i dont see an amount value anywhere
is this meant to be the TextLabel?

Chech that the variable coinsAmount its alright, because in coinsFrame, there is not an instance called amount.

Yes I’m sure it’s the same name of my leader stats value.

1 Like

Correct me if I’m wrong, but isn’t the name of the text label that you’re changing “TextLabel” and not “amount”?

Ladies and gentlemen, this is why one opens their output and checks for errors.

Nope no errors? It’s just not displaying it on there

Have you referenced your variable “coinsAmount” correctly? There is no instance named “amount” in your UI, but just the textlabel instance.

local coinsAmount = coinsFrame.TextLabel

Nope ammount is not referenced anywhere and that’s the error I was getting


How would I go about fixing that?

local coinsAmount = coinsFrame.TextLabel.

This should definitely fix it.

Yeah I forgot to name everything correctly when changing the script, Thanks.

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