Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How come my GUI text changes aren't displaying?

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

✓ Accepted answer

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.

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)


This discussion is preserved as it was. New answers, comments, and votes are closed.