Advertisement
Poglo

emoji chat discord

Jun 26th, 2022
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.64 KB | None | 0 0
  1. local insertKey = Enum.KeyCode.RightShift
  2.  
  3. if not game:IsLoaded() then
  4. game.Loaded:Wait()
  5. end
  6.  
  7. local plrs = game:GetService("Players")
  8. local PlayerGui = plrs.LocalPlayer:FindFirstChildOfClass("PlayerGui")
  9. local EmojiList = Instance.new("ScrollingFrame")
  10. local EmojiButton = Instance.new("TextButton")
  11.  
  12. EmojiList.Name = "EmojiList"
  13. EmojiList.Parent = PlayerGui:WaitForChild("Chat").Frame.ChatBarParentFrame.Frame
  14. EmojiList.Active = true
  15. EmojiList.BackgroundColor3 = Color3.new(0, 0, 0)
  16. EmojiList.BackgroundTransparency = 0.6
  17. EmojiList.BorderSizePixel = 0
  18. EmojiList.Position = UDim2.new(0, 0, 0, 42)
  19. EmojiList.Size = UDim2.new(1, 0, 1, 200)
  20. EmojiList.ScrollBarThickness = 4
  21. EmojiList.VerticalScrollBarInset = "Always"
  22. EmojiList.Visible = false
  23.  
  24. EmojiButton.Name = "EmojiButton"
  25. EmojiButton.BackgroundColor3 = Color3.new(0.4, 0.4, 0.4)
  26. EmojiButton.BackgroundTransparency = 1
  27. EmojiButton.BorderSizePixel = 0
  28. EmojiButton.Size = UDim2.new(1, 0, 0, 20)
  29. EmojiButton.Font = Enum.Font.SourceSansBold
  30. EmojiButton.TextSize = 18
  31. EmojiButton.TextColor3 = Color3.new(1, 1, 1)
  32. EmojiButton.TextXAlignment = Enum.TextXAlignment.Left
  33.  
  34. game.StarterGui:SetCore("ChatMakeSystemMessage", {
  35. Text = "Edge's Emoji Chat Loaded. Fetching Emojis...";
  36. Color = Color3.new(255,255,255);
  37. Font = Enum.Font.SourceSans;
  38. FontSize = Enum.FontSize.Size24;
  39. })
  40.  
  41. local selected = 0
  42. local chatbox
  43. local emojil = game:GetService("HttpService"):JSONDecode(game:HttpGet('https://raw.githubusercontent.com/emojione/emojione/master/emoji_strategy.json', true))
  44. local emotes = {}
  45. local emojis = {}
  46. local unicode = loadstring(game:HttpGet(('https://pastebin.com/raw/ESvakmEn'),true))()
  47. for i,w in next,emojil do
  48. local str = ""
  49. for v in w.unicode_output:gmatch("[%a%d]+") do
  50. str = str..unicode(v)
  51. end
  52. emojis[w.shortname:sub(2,-2)] = {str,w.keywords}
  53. emotes[#emotes + 1] = w.shortname:sub(2,-2)
  54. end
  55.  
  56. local emotes,names = emojis,emotes
  57. shared.emotes = emotes
  58. shared.names = names
  59.  
  60. function compare(t,v)
  61. for _,i in next,t do
  62. if i:sub(1,#v):lower() == v:lower() then
  63. return true
  64. end
  65. end
  66. end
  67.  
  68. function insertEmoji(chat,emoji,emojiText)
  69. if chat and emoji and emojiText then
  70. local finalEmojiText = ':'..emojiText..':'
  71. local prefix = string.find(chatbox.Text,":")
  72. local swapChat = string.gsub(chat,chatbox.Text:sub(prefix),finalEmojiText)
  73. local swapEmoji = string.gsub(swapChat,':[%w%p]+:',emoji)
  74. return(swapEmoji)
  75. end
  76. end
  77.  
  78. local e = {}
  79. local n = {}
  80. function update(name)
  81. local t = name
  82. e = {}
  83. n = {}
  84. for i,v in next,emotes do
  85. if i:sub(1,#t):lower() == t:lower() or compare(v[2],t) then
  86. n[#n+1] = i
  87. end
  88. end
  89. table.sort(n,function(a,b)
  90. return a <= b
  91. end)
  92. for i,v in next,n do
  93. e[i] = emotes[v][1]
  94. end
  95. EmojiList:ClearAllChildren()
  96. local namenum = 1
  97. local prefix = string.find(chatbox.Text,":")
  98. if #e ~= 0 then
  99. EmojiList.Visible = true
  100. local YSize = 25
  101. local num = 1
  102. for i,v in next,e do
  103. if i <= 100 then
  104. local Position = ((num * YSize) - YSize)
  105. local b = EmojiButton:Clone()
  106. local emoj = v
  107. local emojName = n[i]
  108. b.Name = tostring(namenum)
  109. b.Parent = EmojiList
  110. b.Text = emoj..' :'..emojName..':'
  111. b.Position = UDim2.new(0,8,0,Position + 5)
  112. EmojiList.CanvasSize = UDim2.new(0,0,0,Position + 30)
  113. if namenum <= 9 then
  114. EmojiList.Size = UDim2.new(1,0,1,EmojiList.CanvasSize.Y.Offset-40)
  115. else
  116. EmojiList.Size = UDim2.new(1,0,1,200)
  117. end
  118. namenum = namenum+1
  119. num = num+1
  120. b.MouseButton1Click:connect(function()
  121. chatbox.Text = insertEmoji(chatbox.Text,emoj,emojName)
  122. chatbox:CaptureFocus()
  123. EmojiList.Visible = false
  124. end)
  125. end
  126. end
  127. else
  128. EmojiList.Visible = false
  129. end
  130. selected = 0
  131. end
  132.  
  133. local chatboxFunc = nil
  134. if pcall(function() chatbox = PlayerGui:WaitForChild("Chat").Frame.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar end) then
  135. local function Index()
  136. chatbox.Text = string.gsub(chatbox.Text, "\t", "")
  137. local prefix = string.find(chatbox.Text,":")
  138. if prefix ~= nil then
  139. local search = chatbox.Text:sub(prefix+1)
  140. if string.find(search," ") then
  141. EmojiList.Visible = false
  142. return
  143. end
  144. local endsearch = string.find(search,":")
  145. if endsearch ~= nil then
  146. update(search:sub(1,endsearch-1))
  147. EmojiList.Visible = false
  148. chatbox.Text = insertEmoji(chatbox.Text,e[1],n[1])
  149. return
  150. end
  151. update(search)
  152. else
  153. EmojiList.Visible = false
  154. end
  155. end
  156. chatboxFunc = chatbox:GetPropertyChangedSignal("Text"):Connect(Index)
  157. PlayerGui.Chat.Frame.ChatBarParentFrame.ChildAdded:Connect(function(newbar)
  158. wait()
  159. if newbar:FindFirstChild('BoxFrame') then
  160. chatbox = PlayerGui.Chat.Frame.ChatBarParentFrame.Frame.BoxFrame.Frame.ChatBar
  161. if chatboxFunc then chatboxFunc:Disconnect() end
  162. chatboxFunc = chatbox:GetPropertyChangedSignal("Text"):Connect(Index)
  163. end
  164. end)
  165. else
  166. print('Custom chat detected.')
  167. end
  168.  
  169. local function updateView()
  170. local index = selected-1
  171. local topPos = math.ceil(EmojiList.CanvasPosition.Y/25)
  172. local bottomPos = math.floor((EmojiList.CanvasPosition.Y + EmojiList.AbsoluteSize.Y)/25)-1
  173. local canvasPos
  174. if index < topPos then
  175. canvasPos = index*25
  176. elseif index > bottomPos then
  177. canvasPos = 25*(index+1)-EmojiList.AbsoluteSize.Y+5
  178. end
  179. if canvasPos then
  180. EmojiList.CanvasPosition = Vector2.new(0,canvasPos)
  181. end
  182. end
  183.  
  184. game:GetService("UserInputService").InputBegan:connect(function(input)
  185. if EmojiList.Visible then
  186. if input.KeyCode == Enum.KeyCode.Down then
  187. local function scrollDown()
  188. local deselect = EmojiList:FindFirstChild(selected)
  189. if deselect ~= nil then
  190. deselect.BackgroundTransparency = 1
  191. end
  192. selected = selected+1
  193. local item = EmojiList:FindFirstChild(selected)
  194. if item ~= nil then
  195. item.BackgroundTransparency = 0.6
  196. else
  197. selected = selected-1
  198. local item = EmojiList:FindFirstChild(selected)
  199. if item ~= nil then
  200. item.BackgroundTransparency = 0.6
  201. end
  202. end
  203. updateView()
  204. end
  205.  
  206. local releaseEvent,stopped
  207. releaseEvent = game:GetService("UserInputService").InputEnded:Connect(function(input)
  208. if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.Down then
  209. releaseEvent:Disconnect()
  210. stopped = true
  211. end
  212. end)
  213. scrollDown()
  214. wait(0.5)
  215. while not stopped do
  216. scrollDown()
  217. wait()
  218. end
  219. elseif input.KeyCode == Enum.KeyCode.Up then
  220. local function scrollUp()
  221. local deselect = EmojiList:FindFirstChild(selected)
  222. if deselect ~= nil then
  223. deselect.BackgroundTransparency = 1
  224. end
  225. selected = selected-1
  226. local item = EmojiList:FindFirstChild(selected)
  227. if item ~= nil then
  228. item.BackgroundTransparency = 0.6
  229. else
  230. selected = selected+1
  231. local item = EmojiList:FindFirstChild(selected)
  232. if item ~= nil then
  233. item.BackgroundTransparency = 0.6
  234. end
  235. end
  236. updateView()
  237. end
  238.  
  239. local releaseEvent,stopped
  240. releaseEvent = game:GetService("UserInputService").InputEnded:Connect(function(input)
  241. if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.Up then
  242. releaseEvent:Disconnect()
  243. stopped = true
  244. end
  245. end)
  246. scrollUp()
  247. wait(0.5)
  248. while not stopped do
  249. scrollUp()
  250. wait()
  251. end
  252. elseif input.KeyCode == insertKey then
  253. if selected ~= 0 then
  254. local item = EmojiList:FindFirstChild(selected)
  255. local prefix = string.find(chatbox.Text,":")
  256. if item ~= nil and prefix ~= nil then
  257. chatbox.Text = insertEmoji(chatbox.Text,e[selected],n[selected])
  258. chatbox:CaptureFocus()
  259. EmojiList.Visible = false
  260. end
  261. end
  262. end
  263. end
  264. end)
  265.  
  266. game.StarterGui:SetCore("ChatMakeSystemMessage", {
  267. Text = "Emojis Loaded";
  268. Color = Color3.new(255,255,255);
  269. Font = Enum.Font.SourceSans;
  270. FontSize = Enum.FontSize.Size24;
  271. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement