What is the problem?
The problem is that it is not scrolling a specific piece of Text (a sequence of a String), but instead keeps doing something else than what it is supposed to do, and sometimes skips a line; However, I have indicated where the problem is.
Was there any Output?
Sadly, I can not provide any, as it is not giving any errors, however, I have added print
functions for specific parts of the code, but they are not printing correctly either (it's not doing specific lines that the code is supposed to do, and sometimes skips a line).
What is the code? Can you provide it?
Yes, I can provide the code, however, it is very confusing, and I have done a lot of changes to try and get it to work finally, but all attempts resulted in the same thing. Here is the code:
local sl = {1}; local ll = {}; local msg = "I'm|a|string!|:D" for q = 1, #msg do if msg:sub(q,q) == "|" then table.insert(sl,q + 1) table.insert(ll,q - 1) end end if #sl == 0 then table.insert(sl,msg) else for x = 1, #sl do if sl[x] and ll[x] then print(sl[x],ll[x],msg:sub(sl[x],ll[x])) elseif sl[x] and not ll[x] then print(sl[x],msg:sub(sl[x])) end end end print("Start Scroll") for x = 1, #sl do --The problem is in this chunk somewhere I'm guessing local CurMes = sl[x] and ll[x] and msg:sub(sl[x],ll[x]) or sl[x] and msg:sub(sl[x]) for k = 1, #CurMes do if sl[x] and ll[x] and CurMes:sub(sl[x],ll[x]) ~= "" then print(CurMes:sub(1,k)) elseif sl[x] and CurMes:sub(sl[x]) ~= "" then print(CurMes:sub(1,k)) end wait(1/25) end wait(2.5) end print("Finished scroll")
message = "|I'm|a|string!|:D" words = {} --[[ string.gsub replaces stuff with other stuff in strings. Here, it's replacing those thingamajigs with the NULL character, \0. If you actually try printing out the NULL character, you won't see anything; it's like nil, as a character. --]] message = message:gsub("|", "\0") counter = 1 --[[ string.gmatch will find every instance of the thing that you give it in the message. I recommend looking up "roblox string patterns" and educating yourself on that. Basically, we are matching anything that is not the NULL character, and adding that to the array of words. --]] for word in message:gmatch("%Z+") do words[counter] = word counter = counter + 1 end for _, word in pairs(words) do for i = 1, #word do print(word:sub(1, i)) end end