pizzaboy2

chat encrypted messages v2

Sep 27th, 2025 (edited)
2,152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.95 KB | None | 0 0
  1. local function notify(title, text)
  2. game:GetService("StarterGui"):SetCore("SendNotification",{
  3. Title = title,
  4. Text = text
  5. })
  6. end
  7. local G2L = {}
  8. if getgenv().chat_encryptor_connections or getgenv().chat_encryptor_connections ~= nil then
  9. for i,v in pairs(getgenv().chat_encryptor_connections) do
  10. v:Disconnect()
  11. end
  12. table.clear(getgenv().chat_encryptor_connections)
  13. notify("done", "script reset")
  14. end
  15. getgenv().chat_encryptor_connections = {}
  16. -- StarterGui.ScreenGui
  17.  
  18. local playergui = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
  19. if playergui:FindFirstChild("chatEncryptionGUI") ~= nil then
  20. playergui:FindFirstChild("chatEncryptionGUI"):Destroy()
  21. end
  22. G2L["1"] = Instance.new("ScreenGui", playergui)
  23. G2L["1"].ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  24. G2L["1"].Name = "chatEncryptionGUI"
  25.  
  26. -- StarterGui.ScreenGui.Frame
  27. if G2L["1"]:FindFirstChild("Frame") ~= nil then
  28. G2L["1"]:FindFirstChild("Frame"):Destroy()
  29. end
  30. G2L["2"] = Instance.new("Frame", G2L["1"])
  31. G2L["2"].BorderSizePixel = 0
  32. G2L["2"].BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  33. G2L["2"].Size = UDim2.new(0, 164, 0, 144)
  34. G2L["2"].Position = UDim2.new(0, 0, 0.74032, 0)
  35. G2L["2"].BorderColor3 = Color3.fromRGB(0, 0, 0)
  36. G2L["2"].Name = "Frame"
  37.  
  38. -- StarterGui.ScreenGui.Frame.encryptButton
  39. if G2L["2"]:FindFirstChild("encryptButton") ~= nil then
  40. G2L["2"]:FindFirstChild("encryptButton"):Destroy()
  41. end
  42. G2L["3"] = Instance.new("TextButton", G2L["2"])
  43. G2L["3"].TextWrapped = true
  44. G2L["3"].BorderSizePixel = 0
  45. G2L["3"].TextColor3 = Color3.fromRGB(0, 0, 0)
  46. G2L["3"].TextSize = 14
  47. G2L["3"].TextScaled = true
  48. G2L["3"].BackgroundColor3 = Color3.fromRGB(171, 255, 0)
  49. G2L["3"].FontFace = Font.new("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.Bold, Enum.FontStyle.Normal)
  50. G2L["3"].Size = UDim2.new(0, 164, 0, 50)
  51. G2L["3"].Name = "encryptButton"
  52. G2L["3"].BorderColor3 = Color3.fromRGB(0, 0, 0)
  53. G2L["3"].Text = "encrypt"
  54. G2L["3"].Position = UDim2.new(0, 0, 0.64931, 0)
  55.  
  56. -- StarterGui.ScreenGui.Frame.TextBox
  57. if G2L["2"]:FindFirstChild("TextBox") ~= nil then
  58. G2L["2"]:FindFirstChild("TextBox"):Destroy()
  59. end
  60. G2L["5"] = Instance.new("TextBox", G2L["2"])
  61. G2L["5"].BorderSizePixel = 0
  62. G2L["5"].TextWrapped = true
  63. G2L["5"].TextSize = 14
  64. G2L["5"].TextColor3 = Color3.fromRGB(0, 0, 0)
  65. G2L["5"].TextScaled = true
  66. G2L["5"].BackgroundColor3 = Color3.fromRGB(0, 171, 255)
  67. G2L["5"].FontFace = Font.new("rbxasset://fonts/families/FredokaOne.json", Enum.FontWeight.Bold, Enum.FontStyle.Normal)
  68. G2L["5"].ClearTextOnFocus = false
  69. G2L["5"].PlaceholderText = "your text here.."
  70. G2L["5"].Size = UDim2.new(0, 164, 0, 50)
  71. G2L["5"].Position = UDim2.new(0, 0, 0.29861, 0)
  72. G2L["5"].BorderColor3 = Color3.fromRGB(0, 0, 0)
  73. G2L["5"].Text = ""
  74. G2L["5"].Name = "TextBox"
  75.  
  76. -- StarterGui.ScreenGui.Frame.title
  77. if G2L["2"]:FindFirstChild("title") ~= nil then
  78. G2L["2"]:FindFirstChild("title"):Destroy()
  79. end
  80. G2L["6"] = Instance.new("TextLabel", G2L["2"])
  81. G2L["6"].TextWrapped = true
  82. G2L["6"].BorderSizePixel = 0
  83. G2L["6"].TextSize = 14
  84. G2L["6"].TextScaled = true
  85. G2L["6"].BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  86. G2L["6"].FontFace = Font.new("rbxasset://fonts/families/SourceSansPro.json", Enum.FontWeight.Bold, Enum.FontStyle.Normal)
  87. G2L["6"].TextColor3 = Color3.fromRGB(0, 0, 0)
  88. G2L["6"].Size = UDim2.new(0, 164, 0, 35)
  89. G2L["6"].BorderColor3 = Color3.fromRGB(0, 0, 0)
  90. G2L["6"].Text = "encrypt gui"
  91. G2L["6"].Name = "title"
  92.  
  93. local function buildKeyArray(keyStr)
  94. local key = {}
  95. for i = #keyStr, 1, -1 do
  96. table.insert(key, string.sub(keyStr, i, i))
  97. end
  98. return key
  99. end
  100.  
  101. local numToSymbol = {["0"]="!", ["1"]="@", ["2"]="#", ["3"]="$", ["4"]="%", ["5"]="^", ["6"]="&", ["7"]="*", ["8"]="(", ["9"]=")"}
  102. local symbolToNum = {}
  103. for n,s in pairs(numToSymbol) do symbolToNum[s] = n end
  104.  
  105. local function encrypt(plaintext, key)
  106. local success, msg = pcall(function()
  107. local output = {}
  108. for i = 1, #plaintext do
  109. local c = string.sub(plaintext, i, i)
  110. local k = key[(i-1) % #key + 1]
  111. local character = string.char(string.byte(c) + string.byte(k))
  112. table.insert(output, character)
  113. end
  114. local base64 = crypt.base64encode(table.concat(output))
  115. local modified = base64:gsub("%d", function(d) return numToSymbol[d] end)
  116. return modified
  117. end)
  118. if not success then return end
  119. if success then return msg end
  120. end
  121.  
  122. local function decrypt(ciphertext, key)
  123. local success, msg = pcall(function()
  124. local restored = ciphertext:gsub(".", function(c)
  125. return symbolToNum[c] or c
  126. end)
  127. local decoded = crypt.base64decode(restored)
  128. local output = {}
  129. for i = 1, #decoded do
  130. local c = string.sub(decoded, i, i)
  131. local k = key[(i-1) % #key + 1]
  132. local character = string.char(string.byte(c) - string.byte(k))
  133. table.insert(output, character)
  134. end
  135. return table.concat(output)
  136. end)
  137. if not success then return end
  138. if success then return msg end
  139. end
  140.  
  141. local function gui_setup()
  142. local frm = G2L["2"]
  143. local text = ""
  144.  
  145. getgenv().chat_encryptor_connections[1] = frm.TextBox:GetPropertyChangedSignal("Text"):Connect(function()
  146. text = frm.TextBox.Text
  147. end)
  148.  
  149. getgenv().chat_encryptor_connections[2] = frm.encryptButton.Activated:Connect(function()
  150. if #text > 0 then
  151. local cipher = encrypt(text, buildKeyArray(getgenv().encryptionKey))
  152. if cipher == nil then
  153. notify("uhhhh.", "could not encrypt")
  154. return
  155. end
  156. setclipboard(cipher)
  157. frm.encryptButton.Text = "copied to clipboard"
  158. task.wait(0.75)
  159. frm.encryptButton.Text = "encrypt"
  160. end
  161. end)
  162. end
  163. task.spawn(gui_setup)
  164.  
  165. getgenv().chat_encryptor_connections[3] = game:GetService("TextChatService").MessageReceived:Connect(function(msg)
  166. local decrypted = decrypt(msg.Text, buildKeyArray(getgenv().encryptionKey))
  167. if decrypted == nil then return end
  168. print("[DECRYPTOR] "..msg.TextSource.Name..": "..decrypted)
  169. end)
  170.  
  171. -- dragging (thanks chatgpt)
  172. -- i made everything else tho
  173.  
  174. -- Make the GUI draggable
  175. local UIS = game:GetService("UserInputService")
  176. local frame = G2L["2"] -- Your GUI Frame
  177. local dragging = false
  178. local dragInput, dragStart, startPos
  179.  
  180. local function update(input)
  181. local delta = input.Position - dragStart
  182. frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X,
  183. startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  184. end
  185.  
  186. frame.InputBegan:Connect(function(input)
  187. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  188. dragging = true
  189. dragStart = input.Position
  190. startPos = frame.Position
  191.  
  192. input.Changed:Connect(function()
  193. if input.UserInputState == Enum.UserInputState.End then
  194. dragging = false
  195. end
  196. end)
  197. end
  198. end)
  199.  
  200. frame.InputChanged:Connect(function(input)
  201. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  202. dragInput = input
  203. end
  204. end)
  205.  
  206. UIS.InputChanged:Connect(function(input)
  207. if input == dragInput and dragging then
  208. update(input)
  209. end
  210. end)
  211.  
  212. return G2L["1"]
  213.  
Add Comment
Please, Sign In to add comment