Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Text Label wont say text?

Asked by 10 years ago

Script:

local gui =  script.gui:Clone()
local codes = {"xYxx28","7882qR","99212x","ui1123","sOap12","1337qw","723OpQ"}
txt = script.ScreenGui.TextLabel
randomnum = math.random(1, #codes) 
txt.Text = codes[randomnum]

I got no errors, but it doesn't work. Help please?

2 answers

Log in to vote
0
Answered by 10 years ago

I wasn't sure about if this would work but then I tested it in Studio and it works fine with few minor changes.

local gui =  script.gui:Clone()
local codes = {"xYxx28","7882qR","99212x","ui1123","sOap12","1337qw","723OpQ"}
txt = script.ScreenGui.TextLabel
randomnum = codes[math.random(1, #codes)]--Here the Variable you made.
txt.Text = randomnum--Since you already made "randomnum" Variable you don't need to add anything extra to it.

If I helped you with your problem then I appreciate if you could accept my Answer

Ad
Log in to vote
0
Answered by 10 years ago

I think that there would be a better way of doing this, and I don't see anything wrong with your code. It could be something else, but sadly we don't know all the details. If you have an error in the output, then please let us know so we can help you more.

local gui =  script.gui:Clone()
txt = script.ScreenGui.TextLabelodes) 
local codes = {"xYxx28","7882qR","99212x","ui1123","sOap12","1337qw","723OpQ"}

txt.Text = codes[math.random(1, #codes)]

Answer this question