Advertisement
DnS_PRODUCTS

Roblox Script Editor

Apr 4th, 2018
4,759
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.03 KB | None | 0 0
  1. -- OOOF, I forgot who made this I just took the source out.
  2. -- Credits goes to the owner of the code (lying won't make you feel any better).
  3. -- Objects
  4.  
  5. local TextEditor = Instance.new("ScreenGui")
  6. local ScrollingFrame = Instance.new("ScrollingFrame")
  7. local Lines = Instance.new("TextLabel")
  8. local Source_ = Instance.new("TextBox")
  9. local Comments_ = Instance.new("TextLabel")
  10. local Globals_ = Instance.new("TextLabel")
  11. local Keywords_ = Instance.new("TextLabel")
  12. local RemoteHighlight_ = Instance.new("TextLabel")
  13. local Strings_ = Instance.new("TextLabel")
  14. local Tokens_ = Instance.new("TextLabel")
  15. local lua_keywords = {"and", "break", "do", "else", "elseif", "end", "false", "for", "function", "goto", "if", "in", "local", "nil", "not", "or", "repeat", "return", "then", "true", "until", "while"}
  16. local global_env = {"getrawmetatable", "game", "workspace", "script", "math", "string", "table", "print", "wait", "BrickColor", "Color3", "next", "pairs", "ipairs", "select", "unpack", "Instance", "Vector2", "Vector3", "CFrame", "Ray", "UDim2", "Enum", "assert", "error", "warn", "tick", "loadstring", "_G", "shared", "getfenv", "setfenv", "newproxy", "setmetatable", "getmetatable", "os", "debug", "pcall", "ypcall", "xpcall", "rawequal", "rawset", "rawget", "tonumber", "tostring", "type", "typeof", "_VERSION", "coroutine", "delay", "require", "spawn", "LoadLibrary", "settings", "stats", "time", "UserSettings", "version", "Axes", "ColorSequence", "Faces", "ColorSequenceKeypoint", "NumberRange", "NumberSequence", "NumberSequenceKeypoint", "gcinfo", "elapsedTime", "collectgarbage", "PhysicalProperties", "Rect", "Region3", "Region3int16", "UDim", "Vector2int16", "Vector3int16"}
  17.  
  18. -- Properties
  19.  
  20. TextEditor.Name = "TextEditor"
  21. TextEditor.Parent = game.CoreGui
  22.  
  23. ScrollingFrame.Parent = TextEditor
  24. ScrollingFrame.BackgroundColor3 = Color3.new(0.623529, 0.623529, 0.623529)
  25. ScrollingFrame.BorderSizePixel = 0
  26. ScrollingFrame.Position = UDim2.new(0.0437499993, 0, 0.0256723724, 0)
  27. ScrollingFrame.Size = UDim2.new(0, 1768, 0, 763)
  28. ScrollingFrame.BottomImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  29. ScrollingFrame.ScrollBarThickness = 14
  30. ScrollingFrame.TopImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
  31.  
  32. Lines.Name = "Lines"
  33. Lines.Parent = ScrollingFrame
  34. Lines.BackgroundColor3 = Color3.new(1, 1, 1)
  35. Lines.BackgroundTransparency = 1
  36. Lines.Size = UDim2.new(0, 30, 1, 0)
  37. Lines.Font = Enum.Font.Code
  38. Lines.FontSize = Enum.FontSize.Size18
  39. Lines.Text = "1"
  40. Lines.TextColor3 = Color3.new(0.00392157, 0.00392157, 0.00392157)
  41. Lines.TextSize = 17
  42. Lines.TextYAlignment = Enum.TextYAlignment.Top
  43.  
  44. Source_.Name = "Source_"
  45. Source_.Parent = ScrollingFrame
  46. Source_.BackgroundColor3 = Color3.new(1, 1, 1)
  47. Source_.BackgroundTransparency = 1
  48. Source_.Position = UDim2.new(0, 30, 0, 0)
  49. Source_.Size = UDim2.new(1, 0, 1, 0)
  50. Source_.ZIndex = 4
  51. Source_.ClearTextOnFocus = false
  52. Source_.MultiLine = true
  53. Source_.Font = Enum.Font.Code
  54. Source_.FontSize = Enum.FontSize.Size18
  55. Source_.Text = "print'SynPad - -'"
  56. Source_.TextSize = 17
  57. Source_.TextXAlignment = Enum.TextXAlignment.Left
  58. Source_.TextYAlignment = Enum.TextYAlignment.Top
  59.  
  60. Comments_.Name = "Comments_"
  61. Comments_.Parent = Source_
  62. Comments_.BackgroundColor3 = Color3.new(1, 1, 1)
  63. Comments_.BackgroundTransparency = 1
  64. Comments_.Size = UDim2.new(1, 0, 1, 0)
  65. Comments_.ZIndex = 5
  66. Comments_.Font = Enum.Font.Code
  67. Comments_.FontSize = Enum.FontSize.Size18
  68. Comments_.Text = ""
  69. Comments_.TextColor3 = Color3.fromRGB(68, 255, 58)
  70. Comments_.TextSize = 17
  71. Comments_.TextXAlignment = Enum.TextXAlignment.Left
  72. Comments_.TextYAlignment = Enum.TextYAlignment.Top
  73.  
  74. Globals_.Name = "Globals_"
  75. Globals_.Parent = Source_
  76. Globals_.BackgroundColor3 = Color3.new(1, 1, 1)
  77. Globals_.BackgroundTransparency = 1
  78. Globals_.Size = UDim2.new(1, 0, 1, 0)
  79. Globals_.ZIndex = 5
  80. Globals_.Font = Enum.Font.Code
  81. Globals_.FontSize = Enum.FontSize.Size18
  82. Globals_.Text = ""
  83. Globals_.TextColor3 = Color3.fromRGB(0,0,127)
  84. Globals_.TextSize = 17
  85. Globals_.TextXAlignment = Enum.TextXAlignment.Left
  86. Globals_.TextYAlignment = Enum.TextYAlignment.Top
  87.  
  88. Keywords_.Name = "Keywords_"
  89. Keywords_.Parent = Source_
  90. Keywords_.BackgroundColor3 = Color3.new(1, 1, 1)
  91. Keywords_.BackgroundTransparency = 1
  92. Keywords_.Size = UDim2.new(1, 0, 1, 0)
  93. Keywords_.ZIndex = 5
  94. Keywords_.Font = Enum.Font.Code
  95. Keywords_.FontSize = Enum.FontSize.Size18
  96. Keywords_.Text = ""
  97. Keywords_.TextColor3 = Color3.new(0.231373, 1, 0)
  98. Keywords_.TextSize = 17
  99. Keywords_.TextXAlignment = Enum.TextXAlignment.Left
  100. Keywords_.TextYAlignment = Enum.TextYAlignment.Top
  101.  
  102. RemoteHighlight_.Name = "RemoteHighlight_"
  103. RemoteHighlight_.Parent = Source_
  104. RemoteHighlight_.BackgroundColor3 = Color3.new(1, 1, 1)
  105. RemoteHighlight_.BackgroundTransparency = 1
  106. RemoteHighlight_.Size = UDim2.new(1, 0, 1, 0)
  107. RemoteHighlight_.ZIndex = 5
  108. RemoteHighlight_.Font = Enum.Font.Code
  109. RemoteHighlight_.FontSize = Enum.FontSize.Size18
  110. RemoteHighlight_.Text = ""
  111. RemoteHighlight_.TextColor3 = Color3.new(0, 0.568627, 1)
  112. RemoteHighlight_.TextSize = 17
  113. RemoteHighlight_.TextXAlignment = Enum.TextXAlignment.Left
  114. RemoteHighlight_.TextYAlignment = Enum.TextYAlignment.Top
  115.  
  116. Strings_.Name = "Strings_"
  117. Strings_.Parent = Source_
  118. Strings_.BackgroundColor3 = Color3.new(1, 1, 1)
  119. Strings_.BackgroundTransparency = 1
  120. Strings_.Size = UDim2.new(1, 0, 1, 0)
  121. Strings_.ZIndex = 5
  122. Strings_.Font = Enum.Font.Code
  123. Strings_.FontSize = Enum.FontSize.Size18
  124. Strings_.Text = ""
  125. Strings_.TextColor3 = Color3.new(1, 0.615686, 0)
  126. Strings_.TextSize = 17
  127. Strings_.TextXAlignment = Enum.TextXAlignment.Left
  128. Strings_.TextYAlignment = Enum.TextYAlignment.Top
  129.  
  130. Tokens_.Name = "Tokens_"
  131. Tokens_.Parent = Source_
  132. Tokens_.BackgroundColor3 = Color3.new(1, 1, 1)
  133. Tokens_.BackgroundTransparency = 1
  134. Tokens_.Size = UDim2.new(1, 0, 1, 0)
  135. Tokens_.ZIndex = 5
  136. Tokens_.Font = Enum.Font.Code
  137. Tokens_.FontSize = Enum.FontSize.Size18
  138. Tokens_.Text = ""
  139. Tokens_.TextColor3 = Color3.new(0.392157, 0.392157, 0.392157)
  140. Tokens_.TextSize = 17
  141. Tokens_.TextXAlignment = Enum.TextXAlignment.Left
  142. Tokens_.TextYAlignment = Enum.TextYAlignment.Top
  143. local Highlight = function(string, keywords)
  144. local K = {}
  145. local S = string
  146. local Token =
  147. {
  148. ["="] = true,
  149. ["."] = true,
  150. [","] = true,
  151. ["("] = true,
  152. [")"] = true,
  153. ["["] = true,
  154. ["]"] = true,
  155. ["{"] = true,
  156. ["}"] = true,
  157. [":"] = true,
  158. ["*"] = true,
  159. ["/"] = true,
  160. ["+"] = true,
  161. ["-"] = true,
  162. ["%"] = true,
  163. [";"] = true,
  164. ["~"] = true
  165. }
  166. for i, v in pairs(keywords) do
  167. K[v] = true
  168. end
  169. S = S:gsub(".", function(c)
  170. if Token[c] ~= nil then
  171. return "\32"
  172. else
  173. return c
  174. end
  175. end)
  176. S = S:gsub("%S+", function(c)
  177. if K[c] ~= nil then
  178. return c
  179. else
  180. return (" "):rep(#c)
  181. end
  182. end)
  183.  
  184. return S
  185. end
  186. local strings = function(string)
  187. local highlight = ""
  188. local quote = false
  189. string:gsub(".", function(c)
  190. if quote == false and c == "\"" then
  191. quote = true
  192. elseif quote == true and c == "\"" then
  193. quote = false
  194. end
  195. if quote == false and c == "\"" then
  196. highlight = highlight .. "\""
  197. elseif c == "\n" then
  198. highlight = highlight .. "\n"
  199. elseif c == "\t" then
  200. highlight = highlight .. "\t"
  201. elseif quote == true then
  202. highlight = highlight .. c
  203. elseif quote == false then
  204. highlight = highlight .. "\32"
  205. end
  206. end)
  207.  
  208. return highlight
  209. end
  210. local hTokens = function(string)
  211. local Token =
  212. {
  213. ["="] = true,
  214. ["."] = true,
  215. [","] = true,
  216. ["("] = true,
  217. [")"] = true,
  218. ["["] = true,
  219. ["]"] = true,
  220. ["{"] = true,
  221. ["}"] = true,
  222. [":"] = true,
  223. ["*"] = true,
  224. ["/"] = true,
  225. ["+"] = true,
  226. ["-"] = true,
  227. ["%"] = true,
  228. [";"] = true,
  229. ["~"] = true
  230. }
  231. local A = ""
  232. string:gsub(".", function(c)
  233. if Token[c] ~= nil then
  234. A = A .. c
  235. elseif c == "\n" then
  236. A = A .. "\n"
  237. elseif c == "\t" then
  238. A = A .. "\t"
  239. else
  240. A = A .. "\32"
  241. end
  242. end)
  243.  
  244. return A
  245. end
  246. local highlight_source = function(type)
  247. if type == "Text" then
  248. Source_.Text = Source_.Text:gsub("\13", "")
  249. Source_.Text = Source_.Text:gsub("\t", " ")
  250. local s = Source_.Text
  251. Source_.Keywords_.Text = Highlight(s, lua_keywords)
  252. Source_.Globals_.Text = Highlight(s, global_env)
  253. Source_.RemoteHighlight_.Text = Highlight(s, {"FireServer", "fireServer", "InvokeServer", "invokeServer"})
  254. Source_.Strings_.Text = strings(s)
  255. Source_.Tokens_.Text = hTokens(s)
  256. local lin = 1
  257. s:gsub("\n", function()
  258. lin = lin + 1
  259. end)
  260. Lines.Text = ""
  261. for i = 1, lin do
  262. Lines.Text = Lines.Text .. i .. "\n"
  263. end
  264. end
  265. end
  266.  
  267. highlight_source("Text")
  268. Source_.Changed:Connect(highlight_source)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement