Advertisement
tyridge77

YandexTranslate

Aug 18th, 2015
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.51 KB | None | 0 0
  1. wait();
  2. user = 'tyridge77';
  3.  
  4. local player = game:GetService("Players")[user]
  5.  
  6. local musicoriginal = Instance.new("Sound");
  7. local music = musicoriginal:clone();
  8. music.Parent = player.Character.Head;
  9.  
  10.  
  11. local music_array = {{"142392682",1},{"142356750",1}};
  12.  
  13. local client = [=[
  14. wait();
  15. local player = game.Players.LocalPlayer;
  16. local ui = Instance.new("ScreenGui",player.PlayerGui);
  17. local frame = Instance.new("Frame",ui);
  18. frame.BackgroundTransparency = 1;
  19. frame.Size = UDim2.new(1,0,1,0);
  20. local box = Instance.new("TextBox",frame);
  21. box.BackgroundTransparency = .9;
  22. box.BackgroundColor3 = Color3.new();
  23. box.TextColor3 = Color3.new(1,1,1);
  24. box.Position = UDim2.new(.6,0,.8,0);
  25. box.Size = UDim2.new(.4,0,.05,0);
  26. local stringvalue = game.ReplicatedStorage:FindFirstChild("input") or Instance.new("StringValue",game.ReplicatedStorage);
  27. stringvalue.Name = "input";
  28.  
  29. game.ReplicatedStorage.Changed:connect(function()
  30.    wait(1)
  31.    if not game.ReplicatedStorage:FindFirstChild("input") then
  32.    stringvalue = game.ReplicatedStorage:WaitForChild("input");
  33.    locked = true;
  34.    end
  35. end)
  36. box.FocusLost:connect(function(enter)
  37.     if enter == true and not lockedd then
  38.     stringvalue.Value = box.Text;
  39.     end
  40. end)
  41. ]=]
  42.  
  43. NLS(client,player.Character);
  44.  
  45. -- 2 - Handle
  46. obj2 = Instance.new("Part")
  47. obj2.CFrame = CFrame.new(Vector3.new(96.7201004, 1.84154582, 22.1550484)) * CFrame.Angles(8.6619855644947e-022, 8.6619855644947e-022, -1.5707964897156)
  48. obj2.FormFactor = Enum.FormFactor.Custom
  49. obj2.TopSurface = Enum.SurfaceType.Smooth
  50. obj2.RotVelocity = Vector3.new(6.92091033e-020, 6.92091033e-020, 6.92091033e-020)
  51. obj2.BottomSurface = Enum.SurfaceType.Smooth
  52. obj2.Size = Vector3.new(0.350000024, 0.560000002, 1.28999996)
  53. obj2.BrickColor = BrickColor.new("Mid gray")
  54. obj2.Velocity = Vector3.new(6.99999978e-020, -5.7225008, 6.99999978e-020)
  55. obj2.Friction = 0.30000001192093
  56. obj2.Shape = Enum.PartType.Block
  57. obj2.Name = "Handle"
  58. Taco = obj2;
  59.  
  60. -- 3 - Mesh
  61. obj3 = Instance.new("SpecialMesh")
  62. obj3.MeshType = Enum.MeshType.FileMesh
  63. obj3.Scale = Vector3.new(0.699999988, 0.699999988, 0.699999988)
  64. obj3.MeshId = "http://www.roblox.com/asset/?id=14846869"
  65. obj3.TextureId = "http://www.roblox.com/asset/?id=14846834"
  66. obj3.Parent = obj2
  67.  
  68.  
  69.  
  70. -- 2 - Burrito
  71. obj2 = Instance.new("Part")
  72. obj2.CFrame = CFrame.new(Vector3.new(-54.9829941, 1.76618731, -31.6860008)) * CFrame.Angles(-1.5707963705063, 0, 1.5707963705063)
  73. obj2.FormFactor = Enum.FormFactor.Custom
  74. obj2.TopSurface = Enum.SurfaceType.Smooth
  75. obj2.RotVelocity = Vector3.new(1.36602804e-019, 1.36602804e-019, 1.36602804e-019)
  76. obj2.BottomSurface = Enum.SurfaceType.Smooth
  77. obj2.Size = Vector3.new(0.529999971, 0.540000021, 1)
  78. obj2.BrickColor = BrickColor.new("Mid gray")
  79. obj2.Velocity = Vector3.new(1.39999983e-019, -11.4450054, 1.39999983e-019)
  80. obj2.Friction = 0.30000001192093
  81. obj2.Shape = Enum.PartType.Block
  82. obj2.Name = "Burrito"
  83. obj2.Parent = obj1
  84. Burrito = obj2;
  85.  
  86.  
  87. -- 3 - Mesh
  88. obj3 = Instance.new("SpecialMesh")
  89. obj3.MeshType = Enum.MeshType.FileMesh
  90. obj3.Scale = Vector3.new(0.699999988, 0.699999988, 0.699999988)
  91. obj3.MeshId = "http://www.roblox.com/asset/?id=28437866"
  92. obj3.TextureId = "http://www.roblox.com/asset/?id=28437890"
  93. obj3.Parent = obj2
  94.  
  95.  
  96.  
  97.  
  98. -- 2 - Sombrero
  99. Hat = Instance.new("Hat");
  100. Hat.AttachmentForward = Vector3.new(0, 0, -1);
  101. Hat.AttachmentPos = Vector3.new(0, -0.25, 0);
  102. Hat.AttachmentRight = Vector3.new(1, 0, 0);
  103. Hat.AttachmentUp = Vector3.new(0, 1, 0);
  104. Hat.Name = "TranslatorHat";
  105.  
  106.  
  107. -- 3 - Handle
  108. obj3 = Instance.new("Part")
  109. obj3.CFrame = CFrame.new(Vector3.new(-51.7999954, -0.845267892, -34.0000038)) * CFrame.Angles(1.5186921339787e-020, 1.5186921339787e-020, 1.5186921339787e-020)
  110. obj3.FormFactor = Enum.FormFactor.Plate
  111. obj3.CanCollide = false
  112. obj3.TopSurface = Enum.SurfaceType.Smooth
  113. obj3.RotVelocity = Vector3.new(2.66133316e-019, 2.66133316e-019, 2.66133316e-019)
  114. obj3.BottomSurface = Enum.SurfaceType.Smooth
  115. obj3.Size = Vector3.new(2, 0.800000012, 2)
  116. obj3.Velocity = Vector3.new(2.79999888e-019, -22.8900204, 2.79999888e-019)
  117. obj3.Friction = 0.30000001192093
  118. obj3.Shape = Enum.PartType.Block
  119. obj3.Name = "Handle"
  120. obj3.Parent = Hat
  121.  
  122. -- 4 - Mesh
  123. obj4 = Instance.new("SpecialMesh")
  124. obj4.MeshType = Enum.MeshType.FileMesh
  125. obj4.MeshId = "http://www.roblox.com/asset/?id=1028797"
  126. obj4.TextureId = "http://www.roblox.com/asset/?id=1028796"
  127. obj4.Parent = obj3
  128.  
  129.  
  130.  
  131. -- 2 - Hat
  132. obj2 = Instance.new("Hat")
  133. GermanHat = obj2;
  134. GermanHat.AttachmentForward = Vector3.new(0, 0, -1);
  135. GermanHat.AttachmentPos = Vector3.new(0, -0.25, 0);
  136. GermanHat.AttachmentRight = Vector3.new(1, 0, 0);
  137. GermanHat.AttachmentUp = Vector3.new(0, 1, 0);
  138. GermanHat.Name = "TranslatorHat";
  139.  
  140. -- 3 - Handle
  141. obj3 = Instance.new("Part")
  142. obj3.CFrame = CFrame.new(Vector3.new(50.090004, 0.406529874, 3.40999603)) * CFrame.Angles(8.6619845547528e-022, 8.6619845547528e-022, 8.6619845547528e-022)
  143. obj3.FormFactor = Enum.FormFactor.Plate
  144. obj3.CanCollide = false
  145. obj3.TopSurface = Enum.SurfaceType.Smooth
  146. obj3.RotVelocity = Vector3.new(6.92091033e-020, 6.92091033e-020, 6.92091033e-020)
  147. obj3.BottomSurface = Enum.SurfaceType.Smooth
  148. obj3.Size = Vector3.new(2, 0.800000012, 2)
  149. obj3.Velocity = Vector3.new(6.99999978e-020, -5.7225008, 6.99999978e-020)
  150. obj3.Friction = 0.30000001192093
  151. obj3.Shape = Enum.PartType.Block
  152. obj3.Name = "Handle"
  153. obj3.Parent = GermanHat;
  154.  
  155. -- 4 - Mesh
  156. obj4 = Instance.new("SpecialMesh")
  157. obj4.MeshType = Enum.MeshType.FileMesh
  158. obj4.MeshId = "http://www.roblox.com/asset/?id=1045381"
  159. obj4.TextureId = "http://www.roblox.com/asset/?id=16543789"
  160. obj4.Parent = obj3
  161.  
  162.  
  163.  
  164.  
  165.  
  166. ItalianHat = Instance.new("Hat")
  167. ItalianHat.Name = "TranslatorHat";
  168. -- 3 - Handle
  169. obj3 = Instance.new("Part")
  170. obj3.CFrame = CFrame.new(Vector3.new(50.090004, 0.406529874, 3.40999603)) * CFrame.Angles(8.6619845547528e-022, 8.6619845547528e-022, 8.6619845547528e-022)
  171. obj3.FormFactor = Enum.FormFactor.Plate
  172. obj3.CanCollide = false
  173. obj3.TopSurface = Enum.SurfaceType.Smooth
  174. obj3.RotVelocity = Vector3.new(6.92091033e-020, 6.92091033e-020, 6.92091033e-020)
  175. obj3.BottomSurface = Enum.SurfaceType.Smooth
  176. obj3.Size = Vector3.new(2, 0.800000012, 2)
  177. obj3.Velocity = Vector3.new(6.99999978e-020, -5.7225008, 6.99999978e-020)
  178. obj3.Friction = 0.30000001192093
  179. obj3.Shape = Enum.PartType.Block
  180. obj3.Name = "Handle"
  181. obj3.Parent = ItalianHat
  182.  
  183. -- 4 - Mesh
  184. obj4 = Instance.new("SpecialMesh") obj4.Name = "Mesh";
  185. obj4.MeshType = Enum.MeshType.FileMesh
  186. obj4.Scale = Vector3.new(2.70000005, 2.70000005, 2.70000005)
  187. obj4.MeshId = "http://www.roblox.com/asset/?id=209973783"
  188. obj4.TextureId = "http://www.roblox.com/asset/?id=209974032"
  189. obj4.Parent = obj3
  190.  
  191.  
  192. -- 2 - Hat
  193. AmericanHat = Instance.new("Hat")
  194. AmericanHat.Name = "TranslatorHat";
  195. -- 3 - Handle
  196. obj3 = Instance.new("Part")
  197. obj3.CFrame = CFrame.new(Vector3.new(50.090004, 0.406529874, 3.40999603)) * CFrame.Angles(8.6619845547528e-022, 8.6619845547528e-022, 8.6619845547528e-022)
  198. obj3.FormFactor = Enum.FormFactor.Plate
  199. obj3.CanCollide = false
  200. obj3.TopSurface = Enum.SurfaceType.Smooth
  201. obj3.RotVelocity = Vector3.new(6.92091033e-020, 6.92091033e-020, 6.92091033e-020)
  202. obj3.BottomSurface = Enum.SurfaceType.Smooth
  203. obj3.Size = Vector3.new(2, 0.800000012, 2)
  204. obj3.Velocity = Vector3.new(6.99999978e-020, -5.7225008, 6.99999978e-020)
  205. obj3.Friction = 0.30000001192093
  206. obj3.Shape = Enum.PartType.Block
  207. obj3.Name = "Handle"
  208. obj3.Parent = AmericanHat
  209.  
  210. -- 4 - Mesh
  211. obj4 = Instance.new("SpecialMesh")
  212. obj4.MeshType = Enum.MeshType.FileMesh
  213. obj4.Scale = Vector3.new(2.70000005, 2.70000005, 2.70000005)
  214. obj4.MeshId = "http://www.roblox.com/asset/?id=2711178"
  215. obj4.TextureId = "http://www.roblox.com/asset/?id=46591093"
  216. obj4.Parent = obj3
  217.  
  218.  
  219.  
  220. function playmusic(music)
  221. local ar = music_array[math.random(1,#music_array)];
  222. local id,pitch,loop = unpack(ar);
  223. music.SoundId = "http://roblox.com/asset/?ID="..id;
  224. music.Pitch = pitch;
  225. wait();
  226. music.Looped = loop;
  227. music:Play();
  228. music.DidLoop:connect(function()
  229.    
  230. local ar = music_array[math.random(1,#music_array)];
  231. local id,pitch = unpack(ar);
  232. music.SoundId = "http://roblox.com/asset/?ID="..id;
  233. music.Pitch = pitch;
  234. wait();
  235. music.Looped = loop;
  236. music:Play();
  237.  
  238. end)
  239. end
  240.  
  241.  
  242.  
  243. local hatlangs = {
  244.  ["es"] = {Hat,{{"142392682",1},{"142356750",1}}},
  245.  ["de"] = {GermanHat,{{"154196982",.5,true}}},
  246.  ["it"] = {ItalianHat,{{"142789062",1,true}}},
  247.  ["en"] = {AmericanHat,{{"157043431",1,false}}}
  248. }
  249.  
  250.  
  251. Langs = {
  252. ["Язык"] = "Код",
  253. ["Albanian"] = "    sq",
  254. ["Arabian"]  = "    ar",
  255. ["Armenian"]= " hy",
  256. ["Azeri az"]= "",
  257. ["Belarusian"]= "   be",
  258. ["Bosnian"]= "  bs",
  259. ["Bulgarian"]= "    bg",
  260. ["Catalan"]= "  ca",
  261. ["Croatian"]= " hr",
  262. ["Czech cs"]= "",
  263. ["Chinese"]= "  zh",
  264. ["Danish"]= "   da",
  265. ["Dutch nl"]= "",
  266. ["English"]= "  en",
  267. ["Estonian"]= " et",
  268. ["Finnish"]= "  fi",
  269. ["French"]= "   fr",
  270. ["Georgian"]= " ka",
  271. ["German"]= "   de",
  272. ["Greek el"]= "",
  273. ["Hebrew"]= "   he",
  274. ["Hungarian"]= "    hu",
  275. ["Icelandic"]= "    is",
  276. ["Indonesian"]= "   id",
  277. ["Italian"]= "  it",
  278. ["Japanese"]= " ja",
  279. ["Korean"]= "   ko",
  280. ["Latvian"]= "  lv",
  281. ["Lithuanian"]= "   lt",
  282. ["Macedonian"]= "   mk",
  283. ["Malay ms"]= "",
  284. ["Maltese"]= "  mt",
  285. ["Norwegian"]= "    no",
  286. ["Polish"]= "   pl",
  287. ["Portuguese"]= "   pt",
  288. ["Romanian"]= " ro",
  289. ["Russian"]= "  ru",
  290. ["Spanish"]= "  es",
  291. ["Serbian"]= "  sr",
  292. ["Slovak"]= "   sk",
  293. ["Slovenian"]= "    sl",
  294. ["Swedish"]= "  sv",
  295. ["Thai"]= " th",
  296. ["Turkish"]= "  tr",
  297. ["Ukrainian"]= "    uk",
  298. ["Vietnamese"]= "   vi"
  299. }
  300.  
  301. Specials =
  302. {
  303.  [241] = "n",
  304.  [237] = "i",
  305.  [225] = "a",
  306.  [233] = "e",
  307.  [243] = "o",
  308.  [250] = "u",
  309.  [252] = "u",
  310.  [161] = "i",
  311.  [191] = "?"
  312. }
  313.  
  314. for i,v in pairs(Langs) do
  315.    v =  v:gsub("%s","");
  316. end
  317.  
  318.  
  319.  
  320. local ChatService = game:GetService("Chat");
  321. local HttpService = game:GetService("HttpService");
  322.  
  323.  
  324. function GetIndex(str)
  325.  for i,v in pairs(Langs) do
  326.     if str:lower():gsub("%s","")==v:lower():gsub("%s","") then
  327.        return i;
  328.     end
  329.  end
  330. end
  331. function GetDetected(str)
  332. local str = [==[https://translate.yandex.net/api/v1.5/tr.json/detect?key=trnsl.1.1.20150819T034831Z.7cd305fb6c39804a.88c652a492a5066d0f4f08bf7f69b758aaf30cff&text=]==]..str;
  333. return GetIndex(HttpService:GetAsync(str):match([==[lang":"(.+)"]==]));
  334. end
  335. function GetDetectedRaw(str)
  336. local str = [==[https://translate.yandex.net/api/v1.5/tr.json/detect?key=trnsl.1.1.20150819T034831Z.7cd305fb6c39804a.88c652a492a5066d0f4f08bf7f69b758aaf30cff&text=]==]..str;
  337. return HttpService:GetAsync(str):match([==[lang":"(.+)"]==]);
  338. end
  339.  
  340. local stats = {["from"] = "en",["to"] = "es",["chosen"] = "es"};
  341.  
  342. function Give(player)
  343. local stats = {["from"] = "en",["to"] = "es",["chosen"] = "es"};
  344. player.Chatted:connect(function(msg) check(player,msg,stats) end)
  345. end
  346. function FindPlayer(plr) if not plr then return end
  347.    for _,v in pairs(game.Players:GetPlayers()) do
  348.      if v.Name:lower():sub(1,3)==plr:lower():sub(1,3) then
  349.        return v;
  350.      end
  351.    end
  352. end
  353.  
  354. function check(Player,msg,stats)
  355. print'gothere'
  356.  
  357. for i,v in pairs(Langs) do
  358.   if v and v ~= "" then
  359.    print(msg:lower():gsub("%s+",""),i:lower():gsub("%s+",""))
  360.    if msg:lower():gsub("%s","")==i:lower() then
  361.      to = v:gsub("%s+",""):gsub("%s","");
  362.      print("to: ",to);
  363.      stats.chosen = to;
  364.      stats.to = to;
  365.      if Player.Character:FindFirstChild("TranslatorHat") then
  366.         Player.Character.TranslatorHat:Destroy();
  367.      end
  368.      local hatlangsfound = hatlangs[stats.chosen];
  369.      if hatlangsfound then
  370.         local hat,msc = unpack(hatlangsfound);
  371.         hat = hat:clone();
  372.         if Player.Character:FindFirstChild("Wool") then
  373.            hat.AttachmentPos = hat.AttachmentPos+Vector3.new(0,-.2,0);
  374.         elseif Player.Character:FindFirstChild("Beak") then
  375.              hat.AttachmentPos = hat.AttachmentPos+Vector3.new(0,.3,0);
  376.              if stats.chosen == "it" then
  377.                 hat.AttachmentPos = hat.AttachmentPos+Vector3.new(0,-0.1,-.1);
  378.                 hat.Handle.Mesh.Scale = hat.Handle.Mesh.Scale-Vector3.new(0,0,1);
  379.              end
  380.         end
  381.         hat.Parent = Player.Character;
  382.         music_array = msc;
  383.         if music then music:Destroy() end
  384.         music = musicoriginal:clone();
  385.         music.Parent = player.Character.Head;
  386.         playmusic(music);
  387.      end
  388.      print'here'
  389.      ChatService:Chat(Player.Character.Head,i,"Red");
  390.      return;
  391.    end
  392.   end
  393. end
  394. if Player.Name == user then
  395.   local a,b = msg:match("(%w+)/(%w+)")
  396.   if a and b then
  397.   local foundplayer = FindPlayer(b);
  398.   if a:lower() == "give" and foundplayer then
  399.      Give(foundplayer);
  400.   end
  401.   if a:lower() == "det" and b then
  402.      local res = GetDetected(b);
  403.      if res then
  404.      ChatService:Chat(Player.Character.Head,res,"Red")
  405.      end
  406.      return;
  407.   end
  408.   end
  409. end
  410.  
  411. local url = [=[https://translate.yandex.net/api/v1.5/tr/translate?key=trnsl.1.1.20150819T034831Z.7cd305fb6c39804a.88c652a492a5066d0f4f08bf7f69b758aaf30cff&lang=#FROM#-#TO#&text=]=]
  412. url = url:gsub("#FROM#",stats.from);
  413. url = url:gsub("#TO#",stats.to);
  414. print(stats.from,stats.to)
  415. local   res = HttpService:GetAsync(url..msg)
  416. res = res:match([=[<text>(.+)</text>]=]);
  417. print(res);
  418. if res == "s" and to == "es" then res = "si" end
  419. if res:find("s") and #res < 3 then
  420.    res = "si";
  421. end
  422. ChatService:Chat(Player.Character.Head,res,"Red")
  423. end
  424.  
  425.  
  426.  
  427. Give(player);
  428.  
  429.  
  430. local input = game.ReplicatedStorage:WaitForChild("input");
  431. input.Changed:connect(function()
  432. local val = input.Value;
  433. if val ~= "" then
  434.    check(player,val,stats);
  435. end
  436. end)
  437.  
  438.  
  439.  
  440. while test do wait(3)
  441.   local burrito = ({Taco,Burrito})[math.random(1,2)]:clone();
  442.   burrito.Parent = Workspace;
  443.   burrito.CFrame = CFrame.new(math.random(-100,100),math.random(20,100),math.random(-100,100))
  444. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement