Why is the textLabel not updating?

local text = script.Parent.Text

--other vars and setup
local credoAmount = dataEvent:InvokeServer(playerID) -- outputs an IntValue (I'm pretty sure, if not than a number of some kind)


while true do
	text = credoAmount
	wait(0.5)
end

Screen Shot 2020-10-21 at 2.57.18 PM

local text = script.Parent

--other vars and setup
local credoAmount = dataEvent:InvokeServer(playerID) -- outputs an IntValue (I'm pretty sure, if not than a number of some kind)


while true do
	text.Text = credoAmount
	wait(0.5)
end

when you were setting the variable text to credoAmount, not the gui.Text to credoAMount

You’re changing the variable of the text and not the script’s parent attribute, they’re not pointers.
Change the Text property of the script’s parent reference instead:

script.Parent.Text = credoAmount
1 Like

Whoops, forgot to paste in the defining variable ( I typed it in here)
I defined it as local text = script.parent.text

Same problem. Variables don’t automatically stay updated. The same goes for credoAmount. You do NOT want to run this more than you need to. You should find a different way if possible, but this is how you would do this.

local text = script.Parent
--other vars and setup

while true do
	text.Text = dataEvent:InvokeServer(playerID)
	wait(0.5)
end
1 Like