So, I have a script that makes a string value every time someone dies in a round. Here is a snip of it:
x = 0
local this = Instance.new("StringValue")
this.Name = ("dead" .. x + 1 )
this.Value = a.Name
this.Parent = game.ReplicatedFirst.dead
x = x + 1
Trust me, that script works. In another script, I have that it makes a picture of whoever dies when I run it:
game.Workspace.fallen.SurfaceGui.ImageLabel.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=420&y=420&username=" .. game.ReplicatedFirst.dead.dead1.Value
game.Workspace.fallen.SurfaceGui.name.Text = game.ReplicatedFirst.dead.dead1.Value
However, now I am trying to make it so that the script sees how many values there are in the folder and acts off that. For example, if there were 2 values in the folder, it would only go up to two and do this script:
game.Workspace.fallen.SurfaceGui.ImageLabel.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=420&y=420&username=" .. game.ReplicatedFirst.dead.dead1.Value
game.Workspace.fallen.SurfaceGui.name.Text = game.ReplicatedFirst.dead.dead1.Value
wait(2)
game.Workspace.fallen.SurfaceGui.ImageLabel.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=420&y=420&username=" .. game.ReplicatedFirst.dead.dead2.Value
game.Workspace.fallen.SurfaceGui.name.Text = game.ReplicatedFirst.dead.dead2.Value
and if it's three values it would do this script:
game.Workspace.fallen.SurfaceGui.ImageLabel.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=420&y=420&username=" .. game.ReplicatedFirst.dead.dead1.Value
game.Workspace.fallen.SurfaceGui.name.Text = game.ReplicatedFirst.dead.dead1.Value
wait(2)
game.Workspace.fallen.SurfaceGui.ImageLabel.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=420&y=420&username=" .. game.ReplicatedFirst.dead.dead2.Value
game.Workspace.fallen.SurfaceGui.name.Text = game.ReplicatedFirst.dead.dead2.Value
wait(2)
game.Workspace.fallen.SurfaceGui.ImageLabel.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=420&y=420&username=" .. game.ReplicatedFirst.dead.dead3.Value
game.Workspace.fallen.SurfaceGui.name.Text = game.ReplicatedFirst.dead.dead3.Value
I know I can do a = game.ReplicatedFirst.dead:GetChildren() and use #a for each chance, but that would take too long and it's too much, does anyone know any other ways?
If you have questions please leave them below!

9 comments
What do you mean "take too long" or "too much"?
I can do it but I am sure there are easier ways
if you have so many children that it's taking a long time then you could store the values in a folder named
valuesor something and take the children of that folder instead which shouldn't take that longI do store them in a folder, its just I want to know how to find out how to make the script find out how many values there are in the folder
I'm not sure if there is any other way other than #folder:GetChildren() , what exactly is the issue with doing that?
Use a for loop if you want a explanation i can give one.
My bad for in pair() do is what i meant
please give a explanation, i dont usually use pair loops
For in pair() do