SHARE
TWEET

morse code translator in rlua

Vzurxy Apr 9th, 2019 (edited) 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Farewell Infortality.
  2. -- Version: 2.82
  3. -- Instances:
  4. local ScreenGui = Instance.new("ScreenGui")
  5. local Frame = Instance.new("Frame")
  6. local TextLabel = Instance.new("TextLabel")
  7. local TextButton = Instance.new("TextButton")
  8. local out = Instance.new("TextLabel")
  9. local TextBox = Instance.new("TextBox")
  10. local cpy = setclipboard or toclipboard
  11. --Properties:
  12. ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  13. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  14.  
  15. Frame.Parent = ScreenGui
  16. Frame.AnchorPoint = Vector2.new(0.5, 0.5)
  17. Frame.BackgroundColor3 = Color3.new(0.341176, 0.494118, 0.470588)
  18. Frame.Position = UDim2.new(0.5, 0, 0.5, 0)
  19. Frame.Size = UDim2.new(1, 0, 1, 0)
  20.  
  21. TextLabel.Parent = Frame
  22. TextLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  23. TextLabel.BackgroundTransparency = 1
  24. TextLabel.Size = UDim2.new(1, 0, 0.151558071, 0)
  25. TextLabel.Font = Enum.Font.Fantasy
  26. TextLabel.Text = "ENGLISH TO MORSE CODE"
  27. TextLabel.TextColor3 = Color3.new(0, 0, 0)
  28. TextLabel.TextScaled = true
  29. TextLabel.TextSize = 14
  30. TextLabel.TextWrapped = true
  31.  
  32. TextButton.Parent = Frame
  33. TextButton.AnchorPoint = Vector2.new(0.5, 0)
  34. TextButton.BackgroundColor3 = Color3.new(0.690196, 1, 0.94902)
  35. TextButton.Position = UDim2.new(0.5, 0, 0.5, 0)
  36. TextButton.Size = UDim2.new(0.152207002, 0, 0.0708215311, 0)
  37. TextButton.Font = Enum.Font.Fantasy
  38. TextButton.Text = "TRANSLATE"
  39. TextButton.TextColor3 = Color3.new(0, 0, 0)
  40. TextButton.TextScaled = true
  41. TextButton.TextSize = 14
  42. TextButton.TextWrapped = true
  43.  
  44. out.Name = "out"
  45. out.Parent = Frame
  46. out.BackgroundColor3 = Color3.new(0.690196, 1, 0.94902)
  47. out.Position = UDim2.new(0.629375935, 0, 0.151558071, 0)
  48. out.Size = UDim2.new(0.281582952, 0, 0.848441899, 0)
  49. out.Font = Enum.Font.Fantasy
  50. out.Text = "OUTPUT"
  51. out.TextColor3 = Color3.new(0, 0, 0)
  52. out.TextScaled = true
  53. out.TextSize = 14
  54. out.TextWrapped = true
  55.  
  56. TextBox.Parent = Frame
  57. TextBox.BackgroundColor3 = Color3.new(0.690196, 1, 0.94902)
  58. TextBox.Position = UDim2.new(0.110350072, 0, 0.351274788, 0)
  59. TextBox.Size = UDim2.new(0.152207002, 0, 0.349858344, 0)
  60. TextBox.Font = Enum.Font.Fantasy
  61. TextBox.PlaceholderText = "WORDS HERE"
  62. TextBox.Text = ""
  63. TextBox.TextColor3 = Color3.new(0, 0, 0)
  64. TextBox.TextScaled = true
  65. TextBox.TextSize = 14
  66. TextBox.TextWrapped = true
  67. -- Scripts:
  68. function SCRIPT_OAPL79_FAKESCRIPT() -- TextButton.LocalScript
  69.     local script = Instance.new('LocalScript')
  70.     script.Parent = TextButton
  71.     words = {
  72.     "A",
  73.     "B",
  74.     "C",
  75.     "D",
  76.     "E",
  77.     "F",
  78.     "G",
  79.     "H",
  80.     "I",
  81.     "J",
  82.     "K",
  83.     "L",
  84.     "M",
  85.     "N",
  86.     "O",
  87.     "P",
  88.     "Q",
  89.     "R",
  90.     "S",
  91.     "T",
  92.     "U",
  93.     "V",
  94.     "W",
  95.     "X",
  96.     "Y",
  97.     "Z",
  98.     "0",
  99.     "1",
  100.     "2",
  101.     "3",
  102.     "4",
  103.     "5",
  104.     "6",
  105.     "7",
  106.     "8",
  107.     "9",
  108.     }
  109.    
  110.     translatedwords = {
  111.     ".-",
  112.     "-...",
  113.     "-.-.",
  114.     "-..",
  115.     ".",
  116.     "..-.",
  117.     "--.",
  118.     "....",
  119.     "..",
  120.     ".---",
  121.     "-.-",
  122.     ".-..",
  123.     "--",
  124.     "-.",
  125.     "---",
  126.     ".--.",
  127.     "--.-",
  128.     ".-.",
  129.     "...",
  130.     "-",
  131.     "..-",
  132.     "...-",
  133.     ".--",
  134.     "-..-",
  135.     "-.--",
  136.     "--..",
  137.     "-----",
  138.     ".----",
  139.     "..---",
  140.     "...--",
  141.     "....-",
  142.     ".....",
  143.     "-....",
  144.     "--...",
  145.     "---..",
  146.     "----."
  147.     }
  148.    
  149.     local word = ""
  150.     script.Parent.MouseButton1Click:Connect(function()
  151.         local delt = false
  152.         for i = 0 , string.len(script.Parent.Parent.TextBox.Text),1 do
  153.             local t = script.Parent.Parent.TextBox.Text
  154.             if string.len(script.Parent.Parent.TextBox.Text) >= 2000 then
  155.                 wait()
  156.             end
  157.            
  158.             script.Parent.Parent.out.Text = 'Translating... '..100/(string.len(script.Parent.Parent.TextBox.Text))*i ..' % done'
  159.             for a,c in pairs(words) do
  160.                 if t ~= script.Parent.Parent.TextBox.Text then
  161.                     break
  162.                 end
  163.                
  164.                 if string.upper(string.sub(script.Parent.Parent.TextBox.Text,i,i)) == c then
  165.                     word = word..translatedwords[a].." "
  166.                 elseif string.sub(script.Parent.Parent.TextBox.Text,i,i) == " " and delt == false and i ~= 1 then
  167.                     delt = true
  168.                     print(string.sub(script.Parent.Parent.TextBox.Text,i,i))
  169.                     word = word.." / "
  170.                 end
  171.                
  172.             end
  173.         delt = false
  174.         end
  175.         cpy(word)
  176.         script.Parent.Parent.out.Text = "Translated..."
  177.         wait(1)
  178.         script.Parent.Parent.out.Text = word
  179.         word = ""
  180.     end)
  181.  
  182. end
  183. coroutine.resume(coroutine.create(SCRIPT_OAPL79_FAKESCRIPT))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top