For some reason, my text is not updating

So, I test printed the data and it printed out normally and I tested typeof() and it is a string but it doesn’t update my text for some reason, can someone lmk?

It prints the updated data part but the text doesn’t get updated.
Thanks,
Astraltempus

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local data = require(ReplicatedStorage.SCIData)

local flightinfodata = data["FlightInfo"]

local Flightnum = flightinfodata["Flightnum"]

local Aircraft = flightinfodata["Aircraft"]

local Destination = flightinfodata["Destination"]

local Gate = flightinfodata["Gate"]

local Time = flightinfodata["Time"]

local Status = flightinfodata["Status"]

---------------------------------------------------------------------

local statusui = script.Parent.Status.Text

local timeui = script.Parent.Time.Text

local gateui = script.Parent.Gate.Text

local desui = script.Parent.Destination.Text

local aircraft = script.Parent.Aircraft.Text

local flightnum = script.Parent.Flightnum.Text

---------------------------------------------------------------------

local gui = script.Parent.Parent

while true do

statusui = Status

timeui = Time

gateui = Gate

desui = Destination

aircraft = Aircraft

flightnum = Flightnum

print("updated data")

wait(1)

end
1 Like

Hi,
I see your are retreiving the text from UI elements (I suppose) and you store them as variables. While this does store the text in your variable and afterwards it updates your variable, you won’t achieve update of the actual text on the element.

To fix this, you will need to change directly the .Text property and not just the variable.

Example:

script.Parent.Destination.Text = Gate

I’m retrieving from my module data to be displayed on the text label.

I see what are you doing.

In this part, you attempt to change the text’s:

which isn’t actually working, just because you are changing values of variables, not the actual Text.

I also see you are retreving the data from your module script, but you never actually update them in your while loop. I’m not sure if this is intentional, but it really doesn’t seem right to me.

I did this and I used a loop because I don’t want to use metatable because its just a tiny game.

You are just getting the current text of, let’s say Status, and assigning it to statusui as a string variable, then changing that variable.
In conclusion, you HAVE TO use .Text everytime you change the text, you do not want to assign the variable statusui as the Text of Status, but rather set it to the Status Instance then change the text of it.
You are also doing the same mistake with your module, so you should use this instead

local statusui = script.Parent.Status

...

statusui.Text = flightinfodata["Status"]
1 Like

You don’t do .Text. That re-updates the variable to the Status string.

statusui.Text = Status