darthubz
(Darthubz)
June 23, 2023, 2:17am
#1
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?
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
Clippey
(Clippey)
June 23, 2023, 3:01am
#3
for local coinsAmount = coinsFrame.amount, i dont see an amount value anywhere
is this meant to be the TextLabel?
epaes
(epaes)
June 23, 2023, 3:40am
#4
Darthubz:
coinsAmount
Chech that the variable coinsAmount its alright, because in coinsFrame, there is not an instance called amount.
darthubz
(Darthubz)
June 23, 2023, 7:39am
#5
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”?
Vanniris
(Vanni)
June 23, 2023, 8:47am
#7
Ladies and gentlemen, this is why one opens their output and checks for errors.
darthubz
(Darthubz)
June 23, 2023, 11:37am
#8
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
darthubz
(Darthubz)
June 25, 2023, 12:30pm
#10
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.
darthubz
(Darthubz)
June 25, 2023, 9:47pm
#12
Yeah I forgot to name everything correctly when changing the script, Thanks.
system
(system)
Closed
July 9, 2023, 9:48pm
#13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.