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

Text Label Help?

Does anyone know how to make a script that makes like 7 Text Labels visible without doing

TextLabel1.Visible = true
TextLabel2.Visible = true
TextLabel3.Visible = true
TextLabel4.Visible = true
TextLabel5.Visible = true
TextLabel6.Visible = true
TextLabel7.Visible = true

1 answer

You can use a for loop along with string concatenation to get the names.

for i = 1, 7 do
if script.Parent:FindFirstChild("TextLabel"..i) then
script.Parent["TextLabel"..i].Visible = true;
end
end

Otherwise, you can just loop through everything in 'script.Parent' if they do not have the names 'TextLabel'

for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("TextLabel") then
v.Visible = true;
end
end

Useful Links

Loops: http://wiki.roblox.com/index.php?title=Loops

Concatenation: http://wiki.roblox.com/index.php?title=Concatenation

2 comments

0

The names of the Textlabels arent Textlabels and there are 10 0f them. That was just an example. Will this still work? Thanks though.

0

Edited for you.

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