Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- OOOF, I forgot who made this I just took the source out.
- -- Credits goes to the owner of the code (lying won't make you feel any better).
- -- Objects
- local TextEditor = Instance.new("ScreenGui")
- local ScrollingFrame = Instance.new("ScrollingFrame")
- local Lines = Instance.new("TextLabel")
- local Source_ = Instance.new("TextBox")
- local Comments_ = Instance.new("TextLabel")
- local Globals_ = Instance.new("TextLabel")
- local Keywords_ = Instance.new("TextLabel")
- local RemoteHighlight_ = Instance.new("TextLabel")
- local Strings_ = Instance.new("TextLabel")
- local Tokens_ = Instance.new("TextLabel")
- 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"}
- 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"}
- -- Properties
- TextEditor.Name = "TextEditor"
- TextEditor.Parent = game.CoreGui
- ScrollingFrame.Parent = TextEditor
- ScrollingFrame.BackgroundColor3 = Color3.new(0.623529, 0.623529, 0.623529)
- ScrollingFrame.BorderSizePixel = 0
- ScrollingFrame.Position = UDim2.new(0.0437499993, 0, 0.0256723724, 0)
- ScrollingFrame.Size = UDim2.new(0, 1768, 0, 763)
- ScrollingFrame.BottomImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
- ScrollingFrame.ScrollBarThickness = 14
- ScrollingFrame.TopImage = "rbxasset://textures/ui/Scroll/scroll-middle.png"
- Lines.Name = "Lines"
- Lines.Parent = ScrollingFrame
- Lines.BackgroundColor3 = Color3.new(1, 1, 1)
- Lines.BackgroundTransparency = 1
- Lines.Size = UDim2.new(0, 30, 1, 0)
- Lines.Font = Enum.Font.Code
- Lines.FontSize = Enum.FontSize.Size18
- Lines.Text = "1"
- Lines.TextColor3 = Color3.new(0.00392157, 0.00392157, 0.00392157)
- Lines.TextSize = 17
- Lines.TextYAlignment = Enum.TextYAlignment.Top
- Source_.Name = "Source_"
- Source_.Parent = ScrollingFrame
- Source_.BackgroundColor3 = Color3.new(1, 1, 1)
- Source_.BackgroundTransparency = 1
- Source_.Position = UDim2.new(0, 30, 0, 0)
- Source_.Size = UDim2.new(1, 0, 1, 0)
- Source_.ZIndex = 4
- Source_.ClearTextOnFocus = false
- Source_.MultiLine = true
- Source_.Font = Enum.Font.Code
- Source_.FontSize = Enum.FontSize.Size18
- Source_.Text = "print'SynPad - -'"
- Source_.TextSize = 17
- Source_.TextXAlignment = Enum.TextXAlignment.Left
- Source_.TextYAlignment = Enum.TextYAlignment.Top
- Comments_.Name = "Comments_"
- Comments_.Parent = Source_
- Comments_.BackgroundColor3 = Color3.new(1, 1, 1)
- Comments_.BackgroundTransparency = 1
- Comments_.Size = UDim2.new(1, 0, 1, 0)
- Comments_.ZIndex = 5
- Comments_.Font = Enum.Font.Code
- Comments_.FontSize = Enum.FontSize.Size18
- Comments_.Text = ""
- Comments_.TextColor3 = Color3.fromRGB(68, 255, 58)
- Comments_.TextSize = 17
- Comments_.TextXAlignment = Enum.TextXAlignment.Left
- Comments_.TextYAlignment = Enum.TextYAlignment.Top
- Globals_.Name = "Globals_"
- Globals_.Parent = Source_
- Globals_.BackgroundColor3 = Color3.new(1, 1, 1)
- Globals_.BackgroundTransparency = 1
- Globals_.Size = UDim2.new(1, 0, 1, 0)
- Globals_.ZIndex = 5
- Globals_.Font = Enum.Font.Code
- Globals_.FontSize = Enum.FontSize.Size18
- Globals_.Text = ""
- Globals_.TextColor3 = Color3.fromRGB(0,0,127)
- Globals_.TextSize = 17
- Globals_.TextXAlignment = Enum.TextXAlignment.Left
- Globals_.TextYAlignment = Enum.TextYAlignment.Top
- Keywords_.Name = "Keywords_"
- Keywords_.Parent = Source_
- Keywords_.BackgroundColor3 = Color3.new(1, 1, 1)
- Keywords_.BackgroundTransparency = 1
- Keywords_.Size = UDim2.new(1, 0, 1, 0)
- Keywords_.ZIndex = 5
- Keywords_.Font = Enum.Font.Code
- Keywords_.FontSize = Enum.FontSize.Size18
- Keywords_.Text = ""
- Keywords_.TextColor3 = Color3.new(0.231373, 1, 0)
- Keywords_.TextSize = 17
- Keywords_.TextXAlignment = Enum.TextXAlignment.Left
- Keywords_.TextYAlignment = Enum.TextYAlignment.Top
- RemoteHighlight_.Name = "RemoteHighlight_"
- RemoteHighlight_.Parent = Source_
- RemoteHighlight_.BackgroundColor3 = Color3.new(1, 1, 1)
- RemoteHighlight_.BackgroundTransparency = 1
- RemoteHighlight_.Size = UDim2.new(1, 0, 1, 0)
- RemoteHighlight_.ZIndex = 5
- RemoteHighlight_.Font = Enum.Font.Code
- RemoteHighlight_.FontSize = Enum.FontSize.Size18
- RemoteHighlight_.Text = ""
- RemoteHighlight_.TextColor3 = Color3.new(0, 0.568627, 1)
- RemoteHighlight_.TextSize = 17
- RemoteHighlight_.TextXAlignment = Enum.TextXAlignment.Left
- RemoteHighlight_.TextYAlignment = Enum.TextYAlignment.Top
- Strings_.Name = "Strings_"
- Strings_.Parent = Source_
- Strings_.BackgroundColor3 = Color3.new(1, 1, 1)
- Strings_.BackgroundTransparency = 1
- Strings_.Size = UDim2.new(1, 0, 1, 0)
- Strings_.ZIndex = 5
- Strings_.Font = Enum.Font.Code
- Strings_.FontSize = Enum.FontSize.Size18
- Strings_.Text = ""
- Strings_.TextColor3 = Color3.new(1, 0.615686, 0)
- Strings_.TextSize = 17
- Strings_.TextXAlignment = Enum.TextXAlignment.Left
- Strings_.TextYAlignment = Enum.TextYAlignment.Top
- Tokens_.Name = "Tokens_"
- Tokens_.Parent = Source_
- Tokens_.BackgroundColor3 = Color3.new(1, 1, 1)
- Tokens_.BackgroundTransparency = 1
- Tokens_.Size = UDim2.new(1, 0, 1, 0)
- Tokens_.ZIndex = 5
- Tokens_.Font = Enum.Font.Code
- Tokens_.FontSize = Enum.FontSize.Size18
- Tokens_.Text = ""
- Tokens_.TextColor3 = Color3.new(0.392157, 0.392157, 0.392157)
- Tokens_.TextSize = 17
- Tokens_.TextXAlignment = Enum.TextXAlignment.Left
- Tokens_.TextYAlignment = Enum.TextYAlignment.Top
- local Highlight = function(string, keywords)
- local K = {}
- local S = string
- local Token =
- {
- ["="] = true,
- ["."] = true,
- [","] = true,
- ["("] = true,
- [")"] = true,
- ["["] = true,
- ["]"] = true,
- ["{"] = true,
- ["}"] = true,
- [":"] = true,
- ["*"] = true,
- ["/"] = true,
- ["+"] = true,
- ["-"] = true,
- ["%"] = true,
- [";"] = true,
- ["~"] = true
- }
- for i, v in pairs(keywords) do
- K[v] = true
- end
- S = S:gsub(".", function(c)
- if Token[c] ~= nil then
- return "\32"
- else
- return c
- end
- end)
- S = S:gsub("%S+", function(c)
- if K[c] ~= nil then
- return c
- else
- return (" "):rep(#c)
- end
- end)
- return S
- end
- local strings = function(string)
- local highlight = ""
- local quote = false
- string:gsub(".", function(c)
- if quote == false and c == "\"" then
- quote = true
- elseif quote == true and c == "\"" then
- quote = false
- end
- if quote == false and c == "\"" then
- highlight = highlight .. "\""
- elseif c == "\n" then
- highlight = highlight .. "\n"
- elseif c == "\t" then
- highlight = highlight .. "\t"
- elseif quote == true then
- highlight = highlight .. c
- elseif quote == false then
- highlight = highlight .. "\32"
- end
- end)
- return highlight
- end
- local hTokens = function(string)
- local Token =
- {
- ["="] = true,
- ["."] = true,
- [","] = true,
- ["("] = true,
- [")"] = true,
- ["["] = true,
- ["]"] = true,
- ["{"] = true,
- ["}"] = true,
- [":"] = true,
- ["*"] = true,
- ["/"] = true,
- ["+"] = true,
- ["-"] = true,
- ["%"] = true,
- [";"] = true,
- ["~"] = true
- }
- local A = ""
- string:gsub(".", function(c)
- if Token[c] ~= nil then
- A = A .. c
- elseif c == "\n" then
- A = A .. "\n"
- elseif c == "\t" then
- A = A .. "\t"
- else
- A = A .. "\32"
- end
- end)
- return A
- end
- local highlight_source = function(type)
- if type == "Text" then
- Source_.Text = Source_.Text:gsub("\13", "")
- Source_.Text = Source_.Text:gsub("\t", " ")
- local s = Source_.Text
- Source_.Keywords_.Text = Highlight(s, lua_keywords)
- Source_.Globals_.Text = Highlight(s, global_env)
- Source_.RemoteHighlight_.Text = Highlight(s, {"FireServer", "fireServer", "InvokeServer", "invokeServer"})
- Source_.Strings_.Text = strings(s)
- Source_.Tokens_.Text = hTokens(s)
- local lin = 1
- s:gsub("\n", function()
- lin = lin + 1
- end)
- Lines.Text = ""
- for i = 1, lin do
- Lines.Text = Lines.Text .. i .. "\n"
- end
- end
- end
- highlight_source("Text")
- Source_.Changed:Connect(highlight_source)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement