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

How do you correctly update a textLabel?

I'm making a game where a player has items, and I'm brand new to scripting. The items variable is global so every script I have can access them, and I'm trying to set a textLabel's text (The script's parent is the textLabel) to my items variable and it's not working!!! What am I doing wrong?

Here is my code:

_G.items = 0
local textLabel = script.Parent
textLabel.Text = _G.items

2 comments

0

change it through the player gui

0

is there any output?

1 answer

A very inefficient but tolerable way would be: putting a LocalScript inside the textlabel and update the text every frame.

game:GetService("RunService").RenderStepped:connect(function()
	script.Parent.Text = tostring(_G.items)
end)

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