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?

local rEvent = game.ReplicatedStorage:WaitForChild("rEvent")
local currencyGui = game.StarterGui.displayBar

rEvent.OnClientEvent:connect(function(savedTable)
    if savedTable then
        currencyGui.aAmount.Text = savedTable[1]
        currencyGui.bAmount.Text = savedTable[2]
        currencyGui.cAmount.Text = savedTable[3]
    else
        currencyGui.aAmount.Text = "ERR"
        currencyGui.bAmount.Text = "ERR"
        currencyGui.cAmount.Text = "ERR"
        print(currencyGui.aAmount.Text)
    end
end)

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!

local rEvent = game.ReplicatedStorage:WaitForChild("rEvent")
local Player = game.Players.LocalPlayer
local Gui = Player:WaitForChild('PlayerGui')
local currencyGui = Gui .displayBar

rEvent.OnClientEvent:connect(function(savedTable)
    if savedTable then
        currencyGui.aAmount.Text = savedTable[1]
        currencyGui.bAmount.Text = savedTable[2]
        currencyGui.cAmount.Text = savedTable[3]
    else
        currencyGui.aAmount.Text = "ERR"
        currencyGui.bAmount.Text = "ERR"
        currencyGui.cAmount.Text = "ERR"
        print(currencyGui.aAmount.Text)
    end
end)


Answer this question