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

How to create a table of StringValue values?

Asked by
Nidoxs 190
8 years ago

I have a folder in the Workspace containing StringValues with different values. I have a SurfaceGui, with a TextLabel. I want to get all the StringValues put the VALUES of them into a table and make the TextLabel type out those values with 3 seconds in between. I tried this but it didn't work :

script.Parent.Text = ""

local GetNews = game.Workspace.News_Broadcasts:GetChildren()

News = {}

for i = 1,#GetNews do
table.insert(News,GetNews.Value)
end

while wait(3) do
    script.Parent.Text = ""
    local pauses = {",", ";", "-", ".", "?", "!"}
        for a=1,#News do
            script.Parent.Text = ""
                for i=1,string.len(News[a]) do 
                    wait(0.06)
                    script.Parent.Text = script.Parent.Text..News[a]:sub(i,i)
                        for b = 1, #pauses do
                            if pauses[b] == News[a]:sub(i,i) then
                                wait(0.6)
                            end 
                        end
                end
            wait(2)
        end
end

1 answer

Log in to vote
2
Answered by 8 years ago

You need to reference the specific object you're working with. In your example, you were trying to just work with a value of the table called "Value" which of course isn't what you want.

local folder = Workspace.News_Broadcasts
local News = {}

for _, b in pairs(folder:GetChildren()) do
    News[#News + 1] = b.Value
end
0
Thank you very much! Nidoxs 190 — 8y
Ad

Answer this question