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

How to create a table of StringValue values?

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

✓ Accepted answer

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

1 comment

0

Thank you very much!

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