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

Why doesn't the textlabel display the text?

I was making a game where a part generates random numbers and tells them,but it seems that it doesn't display the text when I test my server.

text = game.Workspace.Xpanel.SurfaceGui.TextLabel.Text
while wait() do
	x = math.random(1, 10)
	print (x)
while wait (x) do
	text = "Working."
	wait(1.5)
	text = "Working.."
	wait(1.5)
	text = "Working..."
	break
end
if x == 7 or x == 5 then
	text = "5 and 7 have been chosen"
end
end

1 answer

On line 1, you put the variable text to equal the current text of the TextLabel. So if the current text is "hi", the variable text will have a value of "hi". If you want to set the Text of the TextLabel, removed .Text on line 1, and add it anytime you wish to change the text... So...

text = game.Workspace.Xpanel.SurfaceGui.TextLabel
while wait() do
    x = math.random(1, 10)
    print (x)
while wait (x) do
    text.Text = "Working."
    wait(1.5)
    text.Text = "Working.."
    wait(1.5)
    text.Text = "Working..."
    break
end
if x == 7 or x == 5 then
    text.Text = "5 and 7 have been chosen"
end
end

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