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

Text Label Help?

Asked by 8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

Log in to vote
1
Answered by 8 years ago

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

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. supermanswaqq 65 — 8y
0
Edited for you. DigitalVeer 1473 — 8y
Ad

Answer this question