Basically, my :GetChildren function isn’t getting the values in order, it is displaying a random one first and THEN going in order. Here is the code if you need it:
for i, Line in pairs(Lines:GetChildren()) do
local Text = Line.Value
for i = 1, #Text do
LineLabel.Text = string.sub(Text, 1, i)
Sounds.Talk:Play()
if Skip == true then
LineLabel.Text = Text
Skip = false
break
end
if Exit == true then
break
end
wait(0.07)
end
if Exit == true then
Exit = false
break
end
repeat wait() until Skip == true or Exit == true
Skip = false
end
Okay, I’m not sure I’m doing this right so could you check the table and see if I am?
for i, Line in pairs(Lines:GetChildren()) do
local linestable = Lines:GetChildren()
table.sort(linestable, function(a,b,c)
local name1 = tonumber(a.Name:match("%d+"))
local name2 = tonumber(b.Name:match("%d+"))
return name1 < name2
end)
local Text = Line.Value
for i, Line in pairs(linestable) do
for i = 1, #Text do
LineLabel.Text = string.sub(Text, 1, i)
Sounds.Talk:Play()
if Skip == true then
LineLabel.Text = Text
Skip = false
break
end
if Exit == true then
break
end
wait(0.07)
end
if Exit == true then
Exit = false
break
end
repeat wait() until Skip == true or Exit == true
Skip = false
end
Exit = false
Skip = false
PromptLabel:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear", 0.2)
LineLabel.Visible = true
wait(0.5)
Chatting = false
Detected = false
end
end
end
end
end)
Right now, it doesn’t display the first one first.
local linestable = Lines:GetChildren()
table.sort(linestable, function(a,b,c)
local name1 = tonumber(a.Name:match("%d+"))
local name2 = tonumber(b.Name:match("%d+"))
return name1 < name2
end)
for i, Line in pairs(linestable) do
local Text = Line.Value
for i = 1, #Text do
LineLabel.Text = string.sub(Text, 1, i)
Sounds.Talk:Play()
if Skip == true then
LineLabel.Text = Text
Skip = false
break
end
if Exit == true then
break
end
wait(0.07)
end
if Exit == true then
Exit = false
break
end
repeat wait() until Skip == true or Exit == true
Skip = false
end
Exit = false
Skip = false
PromptLabel:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear", 0.2)
LineLabel.Visible = true
wait(0.5)
Chatting = false
Detected = false