Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. local lastKey = 0
  2. local allStrings = {}
  3.  
  4. function ReplaceString(str, find, replace)
  5. str = tostring(str)
  6. local strStart, strEnd = str:find(find)
  7. return str:sub(1, strStart-1) .. replace .. str:sub(strEnd+1, #str)
  8. end
  9.  
  10. function ParseText(text, endKey)
  11. for i = 1, #text do
  12. if text:sub(i,i) == endKey then
  13. if lastKey == 0 then
  14. table.insert(allStrings, ReplaceString(text:sub(1,i), endKey, ""))
  15. lastKey = i + 1
  16. else
  17. table.insert(allStrings, ReplaceString(text:sub(lastKey, i), endKey, ""))
  18. end
  19. end
  20. end
  21. end
  22.  
  23. function execute()
  24. ParseText(script.Parent.Output.CmdBar.CommandBar.Text,"|")
  25. print(allStrings[1],allStrings[2])
  26. end
  27. script.Parent.Output.CmdBar.Execute.MouseButton1Click:connect(execute)
  28.  
  29.  
  30. I get this in output: /kill nil
  31.  
  32.  
  33. But in the textbox I wrote "/kill|LeRiceFarmer"
  34.  
  35. Why is it nil?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement