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

Script created TextLabel isn't visible?

Asked by 5 years ago

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!

0
TL;DR danglt 185 — 5y
0
change "Color3.new()" to "Color3.fromRGB()" OnaKat 444 — 5y
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. spicychilly2 145 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

0
I did, on line 7 it assigns the TextLabel's Text with the object's name that i know is not nil. spicychilly2 145 — 5y
0
You never classified v.Name MMOOYYEESS 0 — 5y
Ad

Answer this question