Hello devs, I recently came upon the issue, that I cant find out how to split a string into its letters AND spaces. The code is working fine, I just need a way to include spaces in mysplit() function.
function mysplit (inputstr, sep)
if sep == nil then
sep = "%s"
end
local t={}
for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
table.insert(t, str)
end
return t
end
rh.Response_Handler.Changed:Connect(function()
if rh.Response_Handler.Value == false then
rh.Visible = true
sh.Visible = false
print("Response")
if current_pos:GetChildren() ~= nil then
print("Working")
for i, v in pairs(rh:GetChildren()) do
print(v.Name)
if v:IsA("TextButton") then
print(current_pos:FindFirstChild(v.Name).Value)
v.Text = current_pos:FindFirstChild(v.Name).Value
v.MouseButton1Click:Connect(function()
current_pos = current_pos:FindFirstChild(v.Name)
rh.Response_Handler.Value = true
rh.Visible = false
sh.Visible = true
end)
end
end
repeat wait() until rh.Response_Handler.Value == true
end
else
print("Player")
rh.Current_Character.Image = game.Players.LocalPlayer.Character.Head.face.Texture
wait(0.5)
local new_text = mysplit(current_pos.Response.Value)
for i, v in pairs(new_text) do
sh.Text = sh.Text..v
wait(1/#new_text)
end
wait(1)
current_pos = current_pos.Response
wait(2)
sh.Text = ""
end
end)