Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How come my GUI text changes aren't displaying?

Asked by 8 years ago

Hey there, my issue is pretty confusing.

I'm using this local script to get a table from a remote event containing well over 3 entries, but just using the first three, getting them, and changing it on a display bar. For some reason, on the display bar, it doesn't change in-game, yet it still prints out what it was changed to. Anyone know my issue? Am I using the wrong method or something?

01local rEvent = game.ReplicatedStorage:WaitForChild("rEvent")
02local currencyGui = game.StarterGui.displayBar
03 
04rEvent.OnClientEvent:connect(function(savedTable)
05    if savedTable then
06        currencyGui.aAmount.Text = savedTable[1]
07        currencyGui.bAmount.Text = savedTable[2]
08        currencyGui.cAmount.Text = savedTable[3]
09    else
10        currencyGui.aAmount.Text = "ERR"
11        currencyGui.bAmount.Text = "ERR"
12        currencyGui.cAmount.Text = "ERR"
13        print(currencyGui.aAmount.Text)
14    end
15end)

No errors output in console, just the values that are printed.

2 answers

Log in to vote
1
Answered by
udoxas 75
8 years ago

Your problem is you're changing the StarterGui, not the player's PlayerGui. Rookie mistake. If you reset after those changes, you will see the changes.

Ad
Log in to vote
0
Answered by 8 years ago

Easy mistake, Just change it to playergui!

01local rEvent = game.ReplicatedStorage:WaitForChild("rEvent")
02local Player = game.Players.LocalPlayer
03local Gui = Player:WaitForChild('PlayerGui')
04local currencyGui = Gui .displayBar
05 
06rEvent.OnClientEvent:connect(function(savedTable)
07    if savedTable then
08        currencyGui.aAmount.Text = savedTable[1]
09        currencyGui.bAmount.Text = savedTable[2]
10        currencyGui.cAmount.Text = savedTable[3]
11    else
12        currencyGui.aAmount.Text = "ERR"
13        currencyGui.bAmount.Text = "ERR"
14        currencyGui.cAmount.Text = "ERR"
15        print(currencyGui.aAmount.Text)
16    end
17end)

Answer this question