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

Script created TextLabel isn't visible?

Hello, i am trying to create this script that gets all the objects in a folder and creates a text label for everyone of them in a ScrollingGui, The script sizes it as should and positions it as should but stuff like the text is invisible and the background is invisible.

Here is my code:

script.Parent.MouseButton1Down:Connect(function()
local list = script.Parent.Parent.Parent.Folder

for i,v in pairs(list:GetChildren()) do
local label = Instance.new("TextLabel")
label.Name = tostring(i)
label.Text = v.Name
label.BackgroundColor3 = Color3.new(67, 67, 67)
label.BorderSizePixel = 0
label.TextColor3 = Color3.new(255, 255, 255)
label.TextSize = 18
label.TextXAlignment = Enum.TextXAlignment.Left
label.TextYAlignment = Enum.TextYAlignment.Center
label.Size = UDim2.new(0, 251, 0, 31)
label.ZIndex = 10
if i == 1 then
label.Position = UDim2.new(0, 0, 0, 0)
else
local lastlabel = script.Parent.Parent.ListContent:FindFirstChild(tostring(i - 1))
label.Position = UDim2.new(0, 0, 0, lastlabel.Position.X.Offset + lastlabel.Size.Y.Offset)
end
label.Parent = script.Parent.Parent.ListContent
end
end)

If enyone can help me that would be great!

3 comments

0

TL;DR

0

change "Color3.new()" to "Color3.fromRGB()"

0

Thank You OnaKat! I tried your suggestion and it worked! You should have made an awenser instead of a comment so i can accept it.

1 answer

~you need to tell it what to put as the text.

2 comments

0

I did, on line 7 it assigns the TextLabel's Text with the object's name that i know is not nil.

0

You never classified v.Name

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