KingPhantom

ScriptEditor & Obfuscator

Jun 17th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.94 KB | None | 0 0
  1. local player = game.Players.LocalPlayer
  2. local uis = game:GetService("UserInputService")
  3.  
  4. local Editor = Instance.new("ScreenGui")
  5. local Main = Instance.new("Frame")
  6. local Container = Instance.new("ScrollingFrame")
  7. local LineNum = Instance.new("TextLabel")
  8. local Source = Instance.new("TextBox")
  9. local Keywords = Instance.new("TextLabel")
  10. local Env = Instance.new("TextLabel")
  11. local Strings = Instance.new("TextLabel")
  12. local Tokens = Instance.new("TextLabel")
  13. local Vars = Instance.new("TextLabel")
  14. local Funcs = Instance.new("TextLabel")
  15. local Nums = Instance.new("TextLabel")
  16. local Comments = Instance.new("TextLabel")
  17. local Methods = Instance.new("TextLabel")
  18. local Title = Instance.new("TextButton")
  19. local Execute = Instance.new("TextButton")
  20. local Clear = Instance.new("TextButton")
  21. local LoadSource = Instance.new("TextButton")
  22. local Copy = Instance.new("TextButton")
  23. local Scripts = Instance.new("ScrollingFrame")
  24.  
  25. Editor.Name = "ScriptEditor"
  26. Editor.Parent = player.PlayerGui
  27.  
  28. Main.Name = "Main"
  29. Main.Parent = Editor
  30. Main.BackgroundColor3 = Color3.new(0.176471, 0.176471, 0.176471)
  31. Main.BorderColor3 = Color3.new(0, 0, 0)
  32. Main.BorderSizePixel = 0
  33. Main.AnchorPoint = Vector2.new(0.5,0.5)
  34. Main.Position = UDim2.new(0.4,0,0.5,0)
  35. Main.Size = UDim2.new(0, 675, 0, 371)
  36.  
  37. Container.Name = "Container"
  38. Container.Parent = Main
  39. Container.BackgroundColor3 = Color3.new(1, 1, 1)
  40. Container.BackgroundTransparency = 1
  41. Container.BorderColor3 = Color3.new(0, 0, 0)
  42. Container.BorderSizePixel = 0
  43. Container.Size = UDim2.new(1, 0, 1, 0)
  44. Container.ZIndex = 91911
  45.  
  46. LineNum.Name = "LineNum"
  47. LineNum.Parent = Container
  48. LineNum.BackgroundColor3 = Color3.new(1, 1, 1)
  49. LineNum.BackgroundTransparency = 1
  50. LineNum.Size = UDim2.new(0, 25, 1, 0)
  51. LineNum.Font = Enum.Font.Cartoon
  52. LineNum.Text = "1"
  53. LineNum.TextColor3 = Color3.new(1, 1, 1)
  54. LineNum.TextSize = 20
  55. LineNum.TextYAlignment = Enum.TextYAlignment.Top
  56.  
  57. Source.Name = "Source"
  58. Source.Parent = Container
  59. Source.BackgroundColor3 = Color3.new(1, 1, 1)
  60. Source.BackgroundTransparency = 1
  61. Source.Position = UDim2.new(0.03, 0, 0, 0)
  62. Source.Size = UDim2.new(0.939999998, 0, 2, 0)
  63. Source.ClearTextOnFocus = false
  64. Source.Font = Enum.Font.Code
  65. Source.MultiLine = true
  66. Source.PlaceholderColor3 = Color3.new(0.603922, 0.603922, 0.603922)
  67. Source.Text = "print(\"Check dev console for info\")"
  68. Source.TextColor3 = Color3.new(0.603922, 0.603922, 0.603922)
  69. Source.TextSize = 20
  70. Source.TextXAlignment = Enum.TextXAlignment.Left
  71. Source.TextYAlignment = Enum.TextYAlignment.Top
  72.  
  73. Keywords.Name = "Keywords"
  74. Keywords.Parent = Source
  75. Keywords.BackgroundColor3 = Color3.new(1, 1, 1)
  76. Keywords.BackgroundTransparency = 1
  77. Keywords.Size = UDim2.new(1, 0, 1, 0)
  78. Keywords.Font = Enum.Font.Code
  79. Keywords.Text = ""
  80. Keywords.TextColor3 = Color3.fromRGB(255,255,255)
  81. Keywords.TextSize = 20
  82. Keywords.TextStrokeColor3 = Color3.new(0.0470588, 0.301961, 1)
  83. Keywords.TextXAlignment = Enum.TextXAlignment.Left
  84. Keywords.TextYAlignment = Enum.TextYAlignment.Top
  85.  
  86. Env.Name = "Env"
  87. Env.Parent = Source
  88. Env.BackgroundColor3 = Color3.new(1, 1, 1)
  89. Env.BackgroundTransparency = 1
  90. Env.Size = UDim2.new(1, 0, 1, 0)
  91. Env.Font = Enum.Font.Code
  92. Env.Text = ""
  93. Env.TextColor3 = Color3.fromRGB(255,255,255)
  94. Env.TextSize = 20
  95. Env.TextStrokeColor3 = Color3.new(0.0470588, 0.301961, 1)
  96. Env.TextXAlignment = Enum.TextXAlignment.Left
  97. Env.TextYAlignment = Enum.TextYAlignment.Top
  98.  
  99. Strings.Name = "Strings"
  100. Strings.Parent = Source
  101. Strings.BackgroundColor3 = Color3.new(1, 1, 1)
  102. Strings.BackgroundTransparency = 1
  103. Strings.Size = UDim2.new(1, 0, 1, 0)
  104. Strings.Font = Enum.Font.Code
  105. Strings.Text = ""
  106. Strings.TextColor3 = Color3.fromRGB(255,255,255)
  107. Strings.TextSize = 20
  108. Strings.TextStrokeColor3 = Color3.new(0.0470588, 0.301961, 1)
  109. Strings.TextXAlignment = Enum.TextXAlignment.Left
  110. Strings.TextYAlignment = Enum.TextYAlignment.Top
  111.  
  112. Tokens.Name = "Tokens"
  113. Tokens.Parent = Source
  114. Tokens.BackgroundColor3 = Color3.new(1, 1, 1)
  115. Tokens.BackgroundTransparency = 1
  116. Tokens.Size = UDim2.new(1, 0, 1, 0)
  117. Tokens.Font = Enum.Font.Code
  118. Tokens.Text = ""
  119. Tokens.TextColor3 = Color3.fromRGB(255,255,255)
  120. Tokens.TextSize = 20
  121. Tokens.TextStrokeColor3 = Color3.new(0.0470588, 0.301961, 1)
  122. Tokens.TextXAlignment = Enum.TextXAlignment.Left
  123. Tokens.TextYAlignment = Enum.TextYAlignment.Top
  124.  
  125. Vars.Name = "Vars"
  126. Vars.Parent = Source
  127. Vars.BackgroundColor3 = Color3.new(1, 1, 1)
  128. Vars.BackgroundTransparency = 1
  129. Vars.Size = UDim2.new(1, 0, 1, 0)
  130. Vars.ZIndex = 2
  131. Vars.Font = Enum.Font.Code
  132. Vars.Text = ""
  133. Vars.TextColor3 = Color3.fromRGB(255,255,255)
  134. Vars.TextSize = 20
  135. Vars.TextStrokeColor3 = Color3.new(0.0470588, 0.301961, 1)
  136. Vars.TextXAlignment = Enum.TextXAlignment.Left
  137. Vars.TextYAlignment = Enum.TextYAlignment.Top
  138.  
  139. Funcs.Name = "Funcs"
  140. Funcs.Parent = Source
  141. Funcs.BackgroundColor3 = Color3.new(1, 1, 1)
  142. Funcs.BackgroundTransparency = 1
  143. Funcs.Size = UDim2.new(1, 0, 1, 0)
  144. Funcs.ZIndex = 3
  145. Funcs.Font = Enum.Font.Code
  146. Funcs.Text = ""
  147. Funcs.TextColor3 = Color3.fromRGB(255,255,255)
  148. Funcs.TextSize = 20
  149. Funcs.TextXAlignment = Enum.TextXAlignment.Left
  150. Funcs.TextYAlignment = Enum.TextYAlignment.Top
  151.  
  152. Methods.Name = "Methods"
  153. Methods.Parent = Source
  154. Methods.BackgroundColor3 = Color3.new(1, 1, 1)
  155. Methods.BackgroundTransparency = 1
  156. Methods.Size = UDim2.new(1, 0, 1, 0)
  157. Methods.ZIndex = 3
  158. Methods.Font = Enum.Font.Code
  159. Methods.Text = ""
  160. Methods.TextColor3 = Color3.fromRGB(255,255,255)
  161. Methods.TextSize = 20
  162. Methods.TextXAlignment = Enum.TextXAlignment.Left
  163. Methods.TextYAlignment = Enum.TextYAlignment.Top
  164.  
  165. Nums.Name = "Nums"
  166. Nums.Parent = Source
  167. Nums.BackgroundColor3 = Color3.new(1, 1, 1)
  168. Nums.BackgroundTransparency = 1
  169. Nums.Size = UDim2.new(1, 0, 1, 0)
  170. Nums.ZIndex = 3
  171. Nums.Font = Enum.Font.Code
  172. Nums.Text = ""
  173. Nums.TextColor3 = Color3.fromRGB(255,255,255)
  174. Nums.TextSize = 20
  175. Nums.TextXAlignment = Enum.TextXAlignment.Left
  176. Nums.TextYAlignment = Enum.TextYAlignment.Top
  177.  
  178. Comments.Name = "Comments"
  179. Comments.Parent = Source
  180. Comments.BackgroundColor3 = Color3.new(1, 1, 1)
  181. Comments.BackgroundTransparency = 1
  182. Comments.Size = UDim2.new(1, 0, 1, 0)
  183. Comments.ZIndex = 3
  184. Comments.Font = Enum.Font.Code
  185. Comments.Text = ""
  186. Comments.TextColor3 = Color3.fromRGB(255,255,255)
  187. Comments.TextSize = 20
  188. Comments.TextXAlignment = Enum.TextXAlignment.Left
  189. Comments.TextYAlignment = Enum.TextYAlignment.Top
  190.  
  191. Title.Name = "Title"
  192. Title.Parent = Main
  193. Title.BackgroundColor3 = Color3.new(0.176471, 0.176471, 0.176471)
  194. Title.BorderSizePixel = 0
  195. Title.Position = UDim2.new(0, 0, -0.118598379, 0)
  196. Title.Size = UDim2.new(1, 0, 0.100000001, 0)
  197. Title.Font = Enum.Font.Cartoon
  198. Title.Text = "Skrubkid's Script Editor"
  199. Title.TextColor3 = Color3.new(1, 1, 1)
  200. Title.TextScaled = true
  201. Title.TextSize = 14
  202. Title.TextWrapped = true
  203. Title.Draggable = true
  204.  
  205. Execute.Name = "Execute"
  206. Execute.Parent = Main
  207. Execute.BackgroundColor3 = Color3.new(0.176471, 0.176471, 0.176471)
  208. Execute.BorderSizePixel = 0
  209. Execute.Position = UDim2.new(-0.000273376703, 0, 1.04625702, 0)
  210. Execute.Size = UDim2.new(0, 200, 0, 50)
  211. Execute.Font = Enum.Font.Cartoon
  212. Execute.Text = "Execute"
  213. Execute.TextColor3 = Color3.new(1, 1, 1)
  214. Execute.TextSize = 25
  215.  
  216. Clear.Name = "Clear"
  217. Clear.Parent = Main
  218. Clear.BackgroundColor3 = Color3.new(0.176471, 0.176471, 0.176471)
  219. Clear.BorderSizePixel = 0
  220. Clear.Position = UDim2.new(0.703430295, 0, 1.04625702, 0)
  221. Clear.Size = UDim2.new(0, 200, 0, 50)
  222. Clear.Font = Enum.Font.Cartoon
  223. Clear.Text = "Clear"
  224. Clear.TextColor3 = Color3.new(1, 1, 1)
  225. Clear.TextSize = 25
  226.  
  227. LoadSource.Name = "LoadSource"
  228. LoadSource.Parent = Main
  229. LoadSource.BackgroundColor3 = Color3.new(0.176471, 0.176471, 0.176471)
  230. LoadSource.BorderSizePixel = 0
  231. LoadSource.Position = UDim2.new(0.351111114, 0, 1.04582214, 0)
  232. LoadSource.Size = UDim2.new(0, 200, 0, 50)
  233. LoadSource.Font = Enum.Font.Cartoon
  234. LoadSource.Text = "Obfuscate"
  235. LoadSource.TextColor3 = Color3.new(1, 1, 1)
  236. LoadSource.TextSize = 25
  237.  
  238. Copy.Name = "Copy"
  239. Copy.Parent = Main
  240. Copy.BackgroundColor3 = Color3.new(0.176471, 0.176471, 0.176471)
  241. Copy.BorderSizePixel = 0
  242. Copy.Position = UDim2.new(0.351111114, 0, 1.04582214, 60)
  243. Copy.Size = UDim2.new(0, 200, 0, 50)
  244. Copy.Font = Enum.Font.Cartoon
  245. Copy.Text = "Copy"
  246. Copy.TextColor3 = Color3.new(1, 1, 1)
  247. Copy.TextSize = 25
  248.  
  249. Scripts.Name = "Scripts"
  250. Scripts.Parent = Main
  251. Scripts.BackgroundColor3 = Color3.new(0.176471, 0.176471, 0.176471)
  252. Scripts.BorderSizePixel = 0
  253. Scripts.Position = UDim2.new(1.01333332, 0, -0.118598379, 0)
  254. Scripts.Size = UDim2.new(0, 186, 0, 482)
  255.  
  256. -- Syntax Highlighting
  257.  
  258. local Data = {
  259.     Highlights = {
  260.         Base = Color3.fromRGB(154,154,154),
  261.         Tokens = Color3.fromRGB(179,255,184),
  262.         Funcs = Color3.fromRGB(174,60,155),
  263.         Methods = Color3.fromRGB(46,255,179),
  264.         Nums = Color3.fromRGB(82,124,174),
  265.         Vars = Color3.fromRGB(255,170,0),
  266.         Env = Color3.fromRGB(255,7,19),
  267.         Keywords = Color3.fromRGB(12,77,255),
  268.         Strings = Color3.fromRGB(255,85,255),
  269.         Comments = Color3.fromRGB(12,215,255)
  270.     },
  271.     Prioritys = {
  272.         Base = 1,
  273.         Tokens = 2,
  274.         Funcs = 3,
  275.         Methods = 4,
  276.         Nums = 5,
  277.         Vars = 6,
  278.         Env = 7,
  279.         Keywords = 8,
  280.         Strings = 9,
  281.         Comments = 10
  282.     },
  283.     Settings = {
  284.         Focused = false
  285.     }
  286. }
  287.  
  288. function PrintTable(t)
  289.     if not type(t) == "table" then return end
  290.     for i,v in ipairs(t) do
  291.         print(i,"=",v)
  292.     end
  293. end
  294.  
  295. local KeywordsT = {
  296.     'and', 'break', 'do', 'else', 'elseif',
  297.     'end', 'false', 'for', 'function', 'goto', 'if',
  298.     'in', 'local', 'nil', 'not', 'or', 'repeat',
  299.     'return', 'then', 'true', 'until', 'while'
  300. };
  301.  
  302.  
  303. local EnvT = {
  304.     "getrawmetatable", "game", "workspace", "script", "math",
  305.      "string", "table", "print", "wait", "BrickColor",
  306.     "Color3", "next", "pairs", "ipairs", "select",
  307.     "unpack", "Instance", "Vector2", "Vector3", "CFrame",
  308.      "Ray", "UDim2", "Enum", "assert", "error", "warn",
  309.      "tick", "loadstring", "_G", "shared", "getfenv",
  310.      "setfenv", "newproxy", "setmetatable", "getmetatable",
  311.      "os", "debug", "pcall", "ypcall", "xpcall", "rawequal",
  312.      "rawset", "rawget", "tonumber", "tostring", "type",
  313.     "typeof", "_VERSION", "coroutine", "delay", "require",
  314.      "spawn", "LoadLibrary", "settings", "stats", "time",
  315.     "UserSettings", "version", "Axes", "ColorSequence",
  316.     "Faces", "ColorSequenceKeypoint", "NumberRange",
  317.     "NumberSequence", "NumberSequenceKeypoint", "gcinfo",
  318.      "elapsedTime", "collectgarbage", "PhysicalProperties",
  319.     "Rect", "Region3", "Region3int16", "UDim", "Vector2int16",
  320.     "Vector3int16"
  321. }
  322.  
  323. local TokensT = {
  324.     ["="] = true,["."] = true,[","] = true,
  325.     ["("] = true,[")"] = true,["["] = true,
  326.     ["]"] = true,["{"] = true,["}"] = true,
  327.     [":"] = true,["*"] = true,["/"] = true,
  328.     ["+"] = true,["-"] = true,["%"] = true,
  329.     [";"] = true,["~"] = true
  330. }
  331.  
  332. local MethodsT = {
  333.     "FireServer","InvokeServer","FireClient","InvokeClient",
  334.     "FindFirstChild","WaitForChild","GetChildren","GetDescendants"
  335. }
  336.  
  337. local variables = {}
  338. local functions = {}
  339.  
  340. function HighlightKeys(str,keebies)
  341.     local fs = str or ""
  342.     local keys = {}
  343.     for i,v in pairs(keebies) do
  344.         keys[v] = true
  345.     end
  346.     fs = fs:gsub(".",function(s)
  347.         if TokensT[s] then
  348.             return " "
  349.         else
  350.             return s
  351.         end
  352.     end)
  353.    
  354.     fs = fs:gsub("%S+",function(s)
  355.         if keys[s] then
  356.             return s
  357.         else
  358.             return string.rep(" ",#s)
  359.         end
  360.     end)
  361.     return fs
  362. end
  363.  
  364. local HighlightTokens = function(string)
  365.     local hl = ""
  366.     string:gsub(".", function(s)
  367.         if TokensT[s] then
  368.             hl = hl .. s
  369.         elseif s == "\n" then
  370.             hl = hl .. "\n"
  371.         elseif s == "\t" then
  372.             hl = hl .. "\t"
  373.         else
  374.             hl = hl .. " "
  375.         end
  376.     end)
  377.  
  378.     return hl
  379. end
  380.  
  381. function HighlightStrings(str)
  382.     local fs = str
  383.     local hl = ""
  384.     local inQuotes = false
  385.    
  386.     fs = fs:gsub(".",function(s)
  387.         if not inQuotes and s == "\"" then inQuotes = true
  388.         elseif inQuotes and s == "\"" then inQuotes = false end
  389.        
  390.         if not inQuotes and s == "\"" then
  391.             hl = hl .. "\""
  392.         elseif s == "\t" then
  393.             hl = hl .. "\t"
  394.         elseif s == "\n" then
  395.             hl = hl .. "\n"
  396.         elseif inQuotes == true then
  397.             hl = hl .. s
  398.         elseif not inQuotes then
  399.             hl = hl .. " "
  400.         end
  401.         return s
  402.     end)
  403.    
  404.     return hl
  405. end
  406.  
  407. function getVars(str)
  408.     local fs = str
  409.     variables = {}
  410.     functions = {}
  411.    
  412.     fs:gsub("local ([%a%d_]+)",function(s)
  413.         if not variables[s] then
  414.             variables[s] = true
  415.         end
  416.         return s
  417.     end)
  418.    
  419.     fs = fs:gsub("function (%a+)",function(s)
  420.         if not functions[s] then
  421.             functions[s] = true
  422.         end
  423.         return s
  424.     end)
  425. end
  426.  
  427. function HighlightVars(str)
  428.     local fs = str or ""
  429.     fs = fs:gsub(".",function(s)
  430.         if TokensT[s] then
  431.             return " "
  432.         else
  433.             return s
  434.         end
  435.     end)
  436.    
  437.     fs = fs:gsub("%S+",function(s)
  438.         if variables[s] then
  439.             return s
  440.         else
  441.             return string.rep(" ",#s)
  442.         end
  443.     end)
  444.     return fs
  445. end
  446.  
  447. function HighlightFuncs(str)
  448.     local fs = str or ""
  449.     fs = fs:gsub(".",function(s)
  450.         if TokensT[s] then
  451.             return " "
  452.         else
  453.             return s
  454.         end
  455.     end)
  456.    
  457.     fs = fs:gsub("%S+",function(s)
  458.         if functions[s] then
  459.             return s
  460.         else
  461.             return string.rep(" ",#s)
  462.         end
  463.     end)
  464.     return fs
  465. end
  466.  
  467. function HighlightMethods(str)
  468.     local fs = str or ""
  469.     local m = {}
  470.     for i,v in pairs(MethodsT) do
  471.         m[v] = true
  472.     end
  473.    
  474.     fs = fs:gsub(".",function(s)
  475.         if TokensT[s] then
  476.             return " "
  477.         else
  478.             return s
  479.         end
  480.     end)
  481.    
  482.     fs = fs:gsub("%S+",function(s)
  483.         if m[s] then
  484.             return s
  485.         else
  486.             return string.rep(" ",#s)
  487.         end
  488.     end)
  489.     return fs
  490. end
  491.  
  492. function HighlightNums(str)
  493.     local fs = str or ""
  494.    
  495.     local n = {0,1,2,3,4,5,6,7,8,9}
  496.     local nn = {}
  497.     for i,v in pairs(n) do
  498.         nn[tostring(v)] = true
  499.     end
  500.    
  501.     fs = fs:gsub(".",function(s)
  502.         if TokensT[s] then
  503.             return " "
  504.         else
  505.             return s
  506.         end
  507.     end)
  508.    
  509.     fs = fs:gsub("%S",function(s)
  510.         if nn[s] then
  511.             return s
  512.         else
  513.             return string.rep(" ",#s)
  514.         end
  515.     end)
  516.     return fs
  517. end
  518.  
  519. function HighlightComments(str)
  520.     local fs = str
  521.     local hl = ""
  522.     local com = false
  523.    
  524.     fs = fs:gsub("([^\n]+)",function(s)
  525.         local n = #s
  526.         local g
  527.         g = s:gsub("%-%-(.-)\n",function(ss)
  528.             local nn = n-#ss
  529.             print(nn)
  530.             return string.rep(" ",nn)..ss
  531.         end)
  532.         if com then
  533.             return g
  534.         else
  535.             return
  536.         end
  537.     end)
  538.    
  539.     return fs
  540. end
  541.  
  542. function syntax(str)
  543.     Source.TextColor3 = Data.Highlights.Base
  544.     for i,v in pairs(Source:GetChildren()) do
  545.         if Data.Highlights[v.Name] then
  546.             v.TextColor3 = Data.Highlights[v.Name]
  547.         end
  548.         if Data.Prioritys[v.Name] then
  549.             v.ZIndex = Data.Prioritys[v.Name]
  550.         end
  551.     end
  552.    
  553.     getVars(Source.Text)
  554.     Source.Text = Source.Text:gsub("\13", "")
  555.     Source.Text = Source.Text:gsub("\t", "    ")
  556.     Source.Text = Source.Text:gsub("\t", "")
  557.     Keywords.Text = HighlightKeys(str,KeywordsT)
  558.     Env.Text = HighlightKeys(str,EnvT)
  559.     Strings.Text = HighlightStrings(str)
  560.     Tokens.Text = HighlightTokens(str)
  561.     Vars.Text = HighlightVars(str)
  562.     Funcs.Text = HighlightFuncs(str)
  563.     Methods.Text = HighlightMethods(str)
  564.     Nums.Text = HighlightNums(str)
  565.    
  566.     LineNum.Text = ""
  567.     line = 1
  568.     str:gsub("\n",function(s)
  569.         line = line + 1
  570.     end)
  571.    
  572.     for i = 1,line do
  573.         LineNum.Text = LineNum.Text .. tostring(i).."\n"
  574.     end
  575.    
  576.     Container.CanvasSize = UDim2.new(0,Source.TextBounds.X+100,0,Source.TextBounds.Y)
  577.     Container.ZIndex = 11
  578.     Source.Position = UDim2.new(0,25,0,0)
  579. end
  580.  
  581. syntax(Source.Text)
  582.  
  583. -- Connections
  584.  
  585. Source.Focused:Connect(function()
  586.     Data.Settings.Focused = true
  587. end)
  588.  
  589. Source.FocusLost:Connect(function()
  590.     Data.Settings.Focused = false
  591. end)
  592.  
  593. Source.Changed:Connect(function()
  594.     syntax(Source.Text)
  595. end)
  596.  
  597. uis.InputBegan:Connect(function(obj,busy)
  598.     local key = obj.KeyCode
  599.    
  600.     if key == Enum.KeyCode.Tab then
  601.         if not Data.Settings.Focused then return end
  602.         wait()
  603.         Source:ReleaseFocus()
  604.         wait()
  605.         Source:CaptureFocus()
  606.     elseif key == Enum.KeyCode.U then
  607.         if busy then return end
  608.         Container.CanvasPosition = Container.CanvasPosition + Vector2.new(40,0)
  609.     elseif key == Enum.KeyCode.Y then
  610.         if busy then return end
  611.         Container.CanvasPosition = Container.CanvasPosition - Vector2.new(40,0)
  612.     end
  613. end)
  614.  
  615. Execute.MouseButton1Click:Connect(function()
  616.     local s,e = pcall(function()
  617.         loadstring(Source.Text)()
  618.     end)
  619.    
  620.     if not s then
  621.         print("Error occurred!")
  622.     end
  623. end)
  624.  
  625. Clear.MouseButton1Click:Connect(function()
  626.     Source.Text = ""
  627. end)
  628.  
  629. LoadSource.MouseButton1Click:Connect(function()
  630.     local start = tick()
  631.     Source.Text = obfuscate(Source.Text)
  632.     print("Obfuscation completed in",tick()-start,"seconds")
  633. end)
  634.  
  635. Title.MouseButton1Click:Connect(function()
  636.     local t = 1
  637.     Main:TweenPosition(UDim2.new(-0.5,0,0.5,0),Enum.EasingDirection.In,Enum.EasingStyle.Back,t)
  638.     wait(t)
  639.     local open = Instance.new("TextButton")
  640.     open.Size = UDim2.new(0,250,0,50)
  641.     open.Position = UDim2.new(-0.5,0,0.7,0)
  642.     open.BorderSizePixel = 0
  643.     open.BackgroundColor3 = Color3.fromRGB(45,45,45)
  644.     open.BackgroundTransparency = 0
  645.     open.Text = "Toggle Script Editor"
  646.     open.TextSize = 15
  647.     open.TextColor3 = Color3.new(1,1,1)
  648.     open.Font = Enum.Font.Cartoon
  649.     open.Parent = Editor
  650.    
  651.     open:TweenPosition(UDim2.new(0,3,0.7,0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,t)
  652.    
  653.     open.MouseButton1Click:Connect(function()
  654.         open:TweenPosition(UDim2.new(-0.4,0,0.7,0),Enum.EasingDirection.In,Enum.EasingStyle.Back,t)
  655.         wait(t)
  656.         Main:TweenPosition(UDim2.new(0.425,0,0.5,0),Enum.EasingDirection.Out,Enum.EasingStyle.Back,t)
  657.         open:Destroy()
  658.     end)
  659. end)
  660.  
  661. Copy.MouseButton1Click:Connect(function()
  662.     if Synapse then
  663.         Synapse:CopyString(Source.Text)
  664.     end
  665. end)
  666.  
  667. -- Scripts
  668.  
  669. local scripts = {
  670.     {"Walkspeed Changer","Zm72J5EE"}
  671. }
  672.  
  673. local preloads = {
  674.     {"Stat Change",[[
  675. local player = game.Players.LocalPlayer
  676. local char = player.Character or player.CharacterAdded:wait()
  677. local hum = char.Humanoid
  678.  
  679. local StatName = "" -- Put stat name here
  680. local value -- Put what you want to set it to here
  681.  
  682. local leaderstats = player:FindFirstChild("leaderstats")
  683. if leaderstats then
  684.     local stat = leaderstats:FindFirstChild(StatName)
  685.     if stat then
  686.         stat.Value = value
  687.     else
  688.         print("No stat with the given name exists!")
  689.     end
  690. else
  691.     print("Leaderstats doesn't exist")
  692. end]]},
  693.     {"JumpPower Changer",[[
  694. local player = game.Players.LocalPlayer
  695. local char = player.Character or player.CharacterAdded:wait()
  696. local hum = char.Humanoid
  697.  
  698. local power = 250 -- Set to what you want your JumpPower to be
  699.  
  700. hum.JumpPower = tonumber(power) or 50
  701. ]]}
  702. }
  703.  
  704. for i,v in pairs(scripts) do
  705.     local c = Scripts:GetChildren()
  706.     if #c > 0 then
  707.         for i,v in pairs(c) do
  708.             v.Position = v.Position + UDim2.new(0,0,0,50)
  709.         end
  710.     end
  711.     local btn = Instance.new("TextButton")
  712.     btn.Size = UDim2.new(1,0,0,50)
  713.     btn.Position = UDim2.new(0,0,0,0)
  714.     btn.BackgroundTransparency = 0
  715.     btn.BackgroundColor3 = Color3.fromRGB(45,45,45)
  716.     btn.BorderSizePixel = 0
  717.     btn.Text = v[1]
  718.     btn.TextSize = 20
  719.     btn.TextColor3 = Color3.new(1,1,1)
  720.     btn.Font = Enum.Font.Cartoon
  721.     btn.Parent = Scripts
  722.    
  723.     btn.MouseButton1Click:Connect(function()
  724.         local url = "https://pastebin.com/raw/"..v[2]
  725.         local suc,err = pcall(function()
  726.             game:HttpGetAsync(url)
  727.         end)
  728.        
  729.         if err then
  730.             Source.Text = "local err = \"Error fetching script\""
  731.         else
  732.             local s = game:HttpGet(url)
  733.             local n = 1
  734.             s:gsub("\n",function(s)
  735.                 n = n + 1
  736.                 return s
  737.             end)
  738.             print(n)
  739.             if n > 50 then
  740.                 Source.Text = "local err = \"Script is to long!\""
  741.                 return
  742.             end
  743.             Source.Text = s
  744.         end
  745.     end)
  746. end
  747.  
  748. for i,v in pairs(preloads) do
  749.     local c = Scripts:GetChildren()
  750.     if #c > 0 then
  751.         for i,v in pairs(c) do
  752.             v.Position = v.Position + UDim2.new(0,0,0,50)
  753.         end
  754.     end
  755.     local btn = Instance.new("TextButton")
  756.     btn.Size = UDim2.new(1,0,0,50)
  757.     btn.Position = UDim2.new(0,0,0,0)
  758.     btn.BackgroundTransparency = 0
  759.     btn.BackgroundColor3 = Color3.fromRGB(45,45,45)
  760.     btn.BorderSizePixel = 0
  761.     btn.Text = v[1]
  762.     btn.TextSize = 20
  763.     btn.TextColor3 = Color3.new(1,1,1)
  764.     btn.Font = Enum.Font.Cartoon
  765.     btn.Parent = Scripts
  766.    
  767.     btn.MouseButton1Click:Connect(function()
  768.         if v[2] then
  769.             Source.Text = v[2]
  770.         end
  771.     end)
  772. end
  773.  
  774. -- Obfuscation
  775.  
  776. local Keywords1 = {
  777.     'and', 'break', 'do', 'else', 'elseif',
  778.     'end', 'false', 'for', 'function', 'goto', 'if',
  779.     'in', 'local', 'nil', 'not', 'or', 'repeat',
  780.     'return', 'then', 'true', 'until', 'while'
  781. };
  782.  
  783. local Keywords = {
  784.     "local"
  785. }
  786.  
  787. local Functions = {
  788.     "game","print","warn","string.sub","string.find","string.gsub",
  789.     "string.gfind","string.reverse","string.rep","string.match",
  790.     "string.char","string.dump","string.byte","string.upper",
  791.     "string.len","string.format","string.gmatch","string.lower",
  792.     "table.setn","table.insert","table.getn","table.foreachi",
  793.     "table.maxn","table.foreach","table.concat","table.remove",
  794.     "table.sort","wait","Color3.new","UDim2.new","Vector3.new",
  795.     "CFrame.new","Instance.new","loadstring","tostring","tonumber"
  796. }
  797.  
  798. local Tokens = {
  799.     ["="] = true,["."] = true,[","] = true,
  800.     ["("] = true,[")"] = true,["["] = true,
  801.     ["]"] = true,["{"] = true,["}"] = true,
  802.     [":"] = true,["*"] = true,["/"] = true,
  803.     ["+"] = true,["-"] = true,["%"] = true,
  804.     [";"] = true,["~"] = true,["\""] = true
  805. }
  806.  
  807. local cache = {}
  808.  
  809. function hash(s)
  810.     local n = ""
  811.     for i = 1,s do
  812.         n = n .. string.char(math.random(97,122))
  813.     end
  814.     return "_"..n
  815. end
  816.  
  817. function hashN(s)
  818.     local n = ""
  819.     for i = 1,s do
  820.         n = n .. math.random(0,9)
  821.     end
  822.     return "_"..n
  823. end
  824.  
  825. local Bools = {
  826.     [true] = hash(8),
  827.     [false] = hash(8)
  828. }
  829.  
  830. local fluffstuff = {
  831.     {"tonumber","\""..hashN(8).."\""},
  832.     {"string.len","\"yourmumisgay\""},
  833.     {"Vector3.new",math.random(1,99).."," .. math.random(1,99).."," .. math.random(1,99)}
  834. }
  835.  
  836. function count(t)
  837.     local n = 0
  838.     for i,v in pairs(t) do
  839.         n = n + 1
  840.     end
  841.     return n
  842. end
  843.  
  844. for i,v in pairs(Functions) do
  845.     local f = v
  846.     table.remove(Functions,i)
  847.     table.insert(Functions,math.random(1,#Functions),f)
  848. end
  849.  
  850.  
  851. local Enums = {}
  852. local Variables = {}
  853. local Env = {}
  854. local Funcs = {}
  855.  
  856. function makeVar(i,v)
  857.     return "local "..i.."="..v..";"
  858. end
  859.  
  860. function getVars2(str)
  861.     local fs = str
  862.    
  863.     fs = fs:gsub("local ([%a%d_]+)",function(s)
  864.         Variables[s] = hash(5)
  865.         return s
  866.     end)
  867. end
  868.  
  869. function hashVars(str)
  870.     local fs = str
  871.    
  872.     for i,v in pairs(Variables) do
  873.         fs = fs:gsub(i,v)
  874.     end
  875.    
  876.     return fs
  877. end
  878.  
  879. function hashEnv(str)
  880.     local fs = str
  881.     for i,v in pairs(Functions) do
  882.         fs = fs:gsub(v,function(s)
  883.             local h = hash(5)
  884.             if not Env[v] then
  885.                 Env[v] = h
  886.                 return h
  887.             else
  888.                 return Env[v]
  889.             end
  890.             return s
  891.         end)
  892.     end
  893.    
  894.     for i,v in pairs(Env) do
  895.         fs = makeVar(v,i)..fs
  896.     end
  897.     return fs
  898. end
  899.  
  900. function hashEnums(str)
  901.     local fs = str
  902.     for i,v in pairs(Enum:GetEnums()) do
  903.         local name = tostring(v)
  904.         local e = Enum[name]:GetEnumItems()
  905.         for ii,vv in pairs(e) do
  906.             Enums[tostring(vv)] = hash(8)
  907.         end
  908.     end
  909.     local oof
  910.     for i,v in pairs(Enums) do 
  911.         fs = string.gsub(str,tostring(i),function(s)
  912.             local a = makeVar(v,i)
  913.             if a then
  914.                 oof = a
  915.             end
  916.             return v
  917.         end)
  918.     end
  919.     if oof then
  920.         fs = oof..fs
  921.     end
  922.    
  923.     return fs
  924. end
  925.  
  926. function byteStrings(str)
  927.     local fs = str
  928.     fs = fs:gsub("\"(.-)\"",function(s)
  929.         local n = ""
  930.         for i = 1,#s do
  931.             n = n .. "\\" .. string.byte(s:sub(i,i))
  932.         end
  933.         return "\""..n.."\""
  934.     end)
  935.    
  936.     return fs
  937. end
  938.  
  939. function format(str)
  940.     local fs = str
  941.     fs = fs:gsub("([^\n]+)",function(s)
  942.         if Tokens[s] or s:sub(#s,#s) == ";" then
  943.             return s
  944.         else
  945.             return s..";"
  946.         end
  947.     end)
  948.    
  949.     fs = fs:gsub("\n","")
  950.    
  951.     return fs
  952. end
  953.  
  954. function obfuscate(str)
  955.     local fs = str
  956.     getVars2(fs)
  957.     fs = byteStrings(fs)
  958.     fs = hashVars(fs)
  959.     fs = hashEnv(fs)
  960.     fs = hashEnums(fs)
  961.    
  962.     return fs
  963. end
  964.  
  965. local msg = [[
  966. --------------------------------------------------------------------
  967. Welcome to SkubKid's Script Editor & Obfuscator
  968. This does lag on slower machines so don't paste in a big script as this is designed for small scripts
  969. If you want to obfuscate a bigger script or have any inquiries go to discord.me/skrubkid to join my community discord!
  970.  
  971. To scroll side to side on the Editor un-select it and press 'Y' or 'U' to scroll sideways
  972. Click on the title to close the Editor
  973. --------------------------------------------------------------------
  974. ]]
  975.  
  976. warn(msg)
  977.  
  978. spawn(function()
  979.     while wait(5) do
  980.         warn("https://discord.me/skrubkid")
  981.     end
  982. end)
Advertisement
Add Comment
Please, Sign In to add comment