Advertisement
KlonoaOverpower

Emoji Add Ons

May 12th, 2020
782
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 8.13 KB | None | 0 0
  1. -- Destroy if Duplicate
  2. if game:WaitForChild("Players").LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("Chat"):WaitForChild("Frame"):FindFirstChild("EmojiSelector") then
  3.     game.Players.LocalPlayer.PlayerGui.Chat.Frame.EmojiSelector:Destroy()
  4. end
  5.  
  6. -- Upgraded Emoji Chat by JustToSeePosts Modified by Overpower HUB
  7. -- Settings --
  8.  
  9. autoFinish = false
  10. autoReplace = true -- keep dis on bru
  11. aliases = {}
  12. autoCompleteKey = Enum.KeyCode.F7
  13. down = Enum.KeyCode.F6
  14. up = Enum.KeyCode.F8
  15. loop = 0.05
  16. spaceAfterEmoji = true
  17. searchFunc = function(Str1, Str2)
  18.     return string.match(Str1,Str2)
  19.     -- Use
  20.     --return string.sub(Str1, 1, #Str2) == Str2
  21.     -- If you want to do startsWith
  22. end
  23.  
  24. -- End Settings --
  25.    
  26. local EmojiSelector = Instance.new("Frame")
  27. local Frame = Instance.new("Frame")
  28. local Emoji = Instance.new("TextLabel")
  29. local TextLabel = Instance.new("TextLabel")
  30. local ScrollingFrame = Instance.new("ScrollingFrame")
  31. local UIListLayout = Instance.new("UIListLayout")
  32.  
  33. --Properties:
  34.  
  35. EmojiSelector.Name = "EmojiSelector"
  36. EmojiSelector.Parent = game:WaitForChild("Players").LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("Chat"):WaitForChild("Frame")
  37. EmojiSelector.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  38. EmojiSelector.BackgroundTransparency = 0.600
  39. EmojiSelector.BorderSizePixel = 0
  40. EmojiSelector.ClipsDescendants = true
  41. EmojiSelector.Position = UDim2.new(1, 2, 0, 2)
  42. EmojiSelector.Size = UDim2.new(0.368219554, 0, 1, -46)
  43.  
  44. Frame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  45. Frame.BackgroundTransparency = 1.000
  46. Frame.BorderSizePixel = 0
  47. Frame.Size = UDim2.new(1, -12, 0, 30)
  48.  
  49. Emoji.Name = "Emoji"
  50. Emoji.Parent = Frame
  51. Emoji.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  52. Emoji.BackgroundTransparency = 1.000
  53. Emoji.Size = UDim2.new(0, 30, 0, 30)
  54. Emoji.Font = Enum.Font.SourceSans
  55. Emoji.Text = "🍕"
  56. Emoji.TextColor3 = Color3.fromRGB(0, 0, 0)
  57. Emoji.TextScaled = true
  58. Emoji.TextSize = 14.000
  59. Emoji.TextWrapped = true
  60.  
  61. TextLabel.Parent = Frame
  62. TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  63. TextLabel.BackgroundTransparency = 1.000
  64. TextLabel.Position = UDim2.new(0, 30, 0, 0)
  65. TextLabel.Size = UDim2.new(1, -30, 1, 0)
  66. TextLabel.Font = Enum.Font.SourceSans
  67. TextLabel.Text = "pizza"
  68. TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  69. TextLabel.TextScaled = true
  70. TextLabel.TextSize = 14.000
  71. TextLabel.TextWrapped = true
  72.  
  73. ScrollingFrame.Parent = EmojiSelector
  74. ScrollingFrame.Active = true
  75. ScrollingFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  76. ScrollingFrame.BackgroundTransparency = 1.000
  77. ScrollingFrame.BorderSizePixel = 0
  78. ScrollingFrame.Size = UDim2.new(1, 0, 1, 0)
  79. ScrollingFrame.ScrollBarThickness = 7
  80.  
  81. UIListLayout.Parent = ScrollingFrame
  82. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  83. UIListLayout.Padding = UDim.new(0, 5)
  84.  
  85. -- Scripts:
  86.  
  87. local function EOIJILT_fake_script() -- EmojiSelector.LocalScript
  88.     local script = Instance.new('LocalScript', EmojiSelector)
  89.  
  90.    
  91.    
  92.     emogies = game:HttpGet("https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json")
  93.     emogies = game.HttpService:JSONDecode(emogies)
  94.     status = "hidden"
  95.     animating = false
  96.     search = ""
  97.     elements = {}
  98.     selection = 1
  99.     -- Build the emoji table
  100.     emoji = {}
  101.     for i,v in pairs(emogies) do
  102.         for a,b in pairs(v.aliases) do
  103.             emoji[b] = v.emoji
  104.         end
  105.     end
  106.     for i,v in pairs(aliases) do
  107.         if string.sub(v,1,1) == ":" then
  108.             emoji[i] = emoji[string.sub(v,2,#v-1)]
  109.         else
  110.             emoji[i] = v
  111.         end
  112.     end
  113.     function setCursor()
  114.         script.Parent.Parent.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar.CursorPosition = 5000000 -- bad way but it work
  115.         if spaceAfterEmoji then
  116.             script.Parent.Parent.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar.Text = script.Parent.Parent.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar.Text .. " "
  117.         end
  118.     end
  119.     function hide()
  120.         --script.Parent.ScrollingFrame.Visible = false
  121.         script.Parent:TweenSize(UDim2.new(0, 0,1, -46), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.4)
  122.         animating = true
  123.         delay(0.4, function() animating = false end)
  124.         status = "hidden"
  125.         return
  126.     end
  127.     function show()
  128.         script.Parent:TweenSize(UDim2.new(0.368, 0,1, -46), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.4)
  129.         animating = true
  130.         delay(0.4, function() animating = false end)
  131.         status = "open"
  132.         --script.Parent.ScrollingFrame.Visible = true
  133.         return
  134.     end
  135.     function findEmoji(a)
  136.         local results = 0
  137.         local lastResult = nil
  138.         for i,v in pairs(emoji) do
  139.             if string.sub(i,1,#a) == a then
  140.                 results = results + 1
  141.                 lastResult = v
  142.             end
  143.         end
  144.         if results == 1 then
  145.             return lastResult
  146.         else
  147.             return a
  148.         end
  149.     end
  150.     script.Parent.Size = UDim2.new(0, 0 , 1, -46)
  151.     game:GetService("UserInputService").InputBegan:Connect(function(input)
  152.         if #elements == 0 then return end
  153.         if not pcall(function()string.reverse(string.match(string.reverse(a), ".-:"))end) then return end
  154.         if input.KeyCode == up then
  155.             elements[selection].BackgroundTransparency = 1
  156.             selection = selection + 1
  157.             selection = math.clamp(selection, 1, #elements)
  158.             elements[selection].BackgroundTransparency = 0.8
  159.             script.Parent.ScrollingFrame.CanvasPosition = Vector2.new(0, selection * 35 - 105)
  160.         end
  161.         if input.KeyCode == down then
  162.             elements[selection].BackgroundTransparency = 1
  163.             selection = selection - 1
  164.             selection = math.clamp(selection, 1, #elements)
  165.             elements[selection].BackgroundTransparency = 0.8
  166.             script.Parent.ScrollingFrame.CanvasPosition = Vector2.new(0, selection * 35 - 105)
  167.         end
  168.         if input.KeyCode == autoCompleteKey then
  169.             local a = script.Parent.Parent.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar.Text
  170.             local b = string.reverse(string.match(string.reverse(a), ".-:"))
  171.             script.Parent.Parent.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar.Text = string.gsub(a, b, ":"..elements[selection].TextLabel.Text..":")
  172.             setCursor()
  173.         end
  174.     end)
  175.    
  176.     while wait(loop) do
  177.         a = script.Parent.Parent.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar.Text
  178.         shouldOpen = false
  179.         for i=0,#a do
  180.             if string.sub(a,i, i) == ":" then
  181.                 shouldOpen = not shouldOpen
  182.             end
  183.         end
  184.         if shouldOpen == true and status == "hidden" and not animating then
  185.             show()
  186.         end
  187.         if shouldOpen == false and status == "open" and not animating then
  188.             hide()
  189.         end
  190.         if shouldOpen == true then
  191.             local b = string.reverse(string.match(string.reverse(a), ".-:"))
  192.             if b ~= ":"  and search ~= b then
  193.                
  194.                 search = b
  195.                 script.Parent.ScrollingFrame.UIListLayout.Parent = script
  196.                 script.Parent.ScrollingFrame:ClearAllChildren()
  197.                 script.UIListLayout.Parent = script.Parent.ScrollingFrame
  198.                 b = string.sub(b,2)
  199.                 b = string.match(b, "[%d%a]+") or ""
  200.                 resultAmount = 0
  201.                 latestResultVal = nil
  202.                 elements = {}
  203.                 selection = 1
  204.                 for i,v in pairs(emoji) do
  205.                     if  searchFunc(i, b) then
  206.                         MaClone = Frame:Clone()
  207.                         MaClone.Parent = ScrollingFrame
  208.                         MaClone.Emoji.Text = v
  209.                         MaClone.TextLabel.Text = i
  210.                         resultAmount = resultAmount+1
  211.                         latestResultVal = v
  212.                         table.insert(elements, MaClone)
  213.                     end
  214.                 end
  215.                 if resultAmount > 0 then
  216.                     elements[selection].BackgroundTransparency = 0.8
  217.                 end
  218.                
  219.                 if resultAmount == 1 and autoFinish then
  220.                     script.Parent.Parent.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar.Text = string.gsub(a, ":"..b, latestResultVal)
  221.                     setCursor()
  222.                 end
  223.             end
  224.         end
  225.         if string.match(a, ":.-:") then
  226.             script.Parent.Parent.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar.Text = string.gsub(a, string.match(a, ":.-:"), emoji[string.sub(string.match(a, ":.-:"), 2, #string.match(a, ":.-:")-1)] or findEmoji(string.sub(string.match(a, ":.-:"), 2, #string.match(a, ":.-:")-1)))
  227.             setCursor()
  228.         end
  229.     end
  230.    
  231.    
  232.    
  233. end
  234. coroutine.wrap(EOIJILT_fake_script)()
  235. local function QMCU_fake_script() -- UIListLayout.LocalScript
  236.     local script = Instance.new('LocalScript', UIListLayout)
  237.  
  238.     while wait() do
  239.         script.Parent.Parent.CanvasSize = UDim2.new(0, script.Parent.AbsoluteContentSize.X, 0, script.Parent.AbsoluteContentSize.Y)
  240.     end
  241. end
  242. coroutine.wrap(QMCU_fake_script)()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement