Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local runService = game:GetService("RunService")
- --local lex = require(script.Lexer1)
- local lex = loadstring(game:HttpGet("https://pastebin.com/raw/vJeTbzJb"))()
- --local create = require(script.CreateService)
- local create = loadstring(game:HttpGet("https://pastebin.com/raw/FWhQhCTS"))()
- local ui = create:Init()
- -- Windows
- local tonicMainWindow = ui:CreatePrimaryWindow()
- local tonicScriptHub = ui:CreateSecondaryWindow()
- local tonicOptionHub = ui:CreateSecondaryWindow()
- tonicScriptHub:ToggleVisibility()
- tonicOptionHub:ToggleVisibility()
- -- Window Titles
- local tonicMainWindowTitle = tonicMainWindow:AddTitle("Tonic Hub - v1.0.0", {Enabled = true, Text = "Tonic"})
- local tonicScriptHubTitle = tonicScriptHub:AddTitle("Script Hub", {Enabled = not true, Text = "Script"})
- local tonicOptionHubTitle = tonicOptionHub:AddTitle("Options", {Enabled = not true, Text = "Options"})
- -- Main Window Container
- local mainWindowContainer = tonicMainWindow:AddContainer(false)
- mainWindowContainer.Position = UDim2.new(0,0,0,30)
- mainWindowContainer.Size = UDim2.new(1,0,1,-30)
- -- Main Window Script Container
- local mainWindowScriptEditor = tonicMainWindow:AddContainer(true, true)
- mainWindowScriptEditor.Position = UDim2.new(0,5,0,5)
- mainWindowScriptEditor.Size = UDim2.new(0,650,0,269)
- mainWindowScriptEditor.BackgroundColor3 = Color3.fromRGB(31,31,31)
- mainWindowScriptEditor.Parent = mainWindowContainer
- -- Main Window Script Tracker
- local mainWindowScriptTracker = tonicMainWindow:AddContainer(false, false)
- mainWindowScriptTracker.Size = UDim2.new(0,50,1,0)
- mainWindowScriptTracker.BackgroundTransparency = 1
- mainWindowScriptTracker.Parent = mainWindowScriptEditor
- local trackerLayout = Instance.new("UIListLayout")
- trackerLayout.Parent = mainWindowScriptTracker
- local function renderLines(quantity)
- for i,v in pairs(mainWindowScriptTracker:GetChildren()) do
- if v:IsA("TextLabel") then
- v:Destroy()
- end
- end
- for i = 1, quantity do
- local newLabel = tonicMainWindow:AddLabel(i)
- newLabel.Parent = mainWindowScriptTracker
- end
- end
- renderLines(1)
- -- Main Window Script Input
- local mainWindowScriptInput
- mainWindowScriptInput = tonicMainWindow:AddInput(function(returned)
- local textBounds = (mainWindowScriptInput.TextBounds.Y / 18)
- renderLines(textBounds)
- end)
- mainWindowScriptInput.Size = UDim2.new(0,590,0,270)
- mainWindowScriptInput.Position = UDim2.new(0,50,0,0)
- mainWindowScriptInput.TextTransparency = 1
- mainWindowScriptInput.Parent = mainWindowScriptEditor
- -- Main Window Options
- local options = {
- [1] = {
- Name = "Tonic.lua",
- Source = "print('helloWorld')"
- },
- [2] = {
- Name = "Aussie.lua",
- Source = "Aussie is awesome"
- }
- }
- -- Main Window Option Tree
- local mainWindowOptions = tonicMainWindow:AddOptionTree(options, function(returned)
- mainWindowScriptInput.Text = returned
- local textBounds = (mainWindowScriptInput.TextBounds.Y / 18)
- renderLines(textBounds)
- end)
- mainWindowOptions.Position = UDim2.new(0,660,0,5)
- mainWindowOptions.Size = UDim2.new(0,135,0,269)
- mainWindowOptions.Parent = mainWindowContainer
- -- Script Hub Option Tree
- local scriptHubScripts = {
- [1] = {
- Name = "Blade Throwing Simulator",
- Source = 'loadstring(game:HttpGet("https://pastebin.com/raw/cSBL2431"))()'
- },
- [2] = {
- Name = "Banning Simulator 2",
- Source = 'loadstring(game:HttpGet("https://pastebin.com/raw/4RXTdpZN"))()'
- }
- }
- local scriptOptionContainer = tonicScriptHub:AddContainer(true, false)
- scriptOptionContainer.Size = UDim2.new(1,-10,0,239)
- scriptOptionContainer.Position = UDim2.new(0,5,0,35)
- local scriptOptionTree = tonicScriptHub:AddOptionTree(scriptHubScripts, function(returned)
- loadstring(returned)()
- end)
- scriptOptionTree.Size = UDim2.new(1,0,1,0)
- scriptOptionTree.Parent = scriptOptionContainer
- -- Main Window Button Container
- local mainWindowButtonContainer = tonicMainWindow:AddContainer(false)
- mainWindowButtonContainer.BackgroundTransparency = 1
- mainWindowButtonContainer.Position = UDim2.new(0,0,1,-47)
- mainWindowButtonContainer.Size = UDim2.new(1,0,0,46)
- local buttonContainerGrid = Instance.new("UIGridLayout")
- buttonContainerGrid.CellPadding = UDim2.new(0,5,0,5)
- buttonContainerGrid.CellSize = UDim2.new(0,90,1,-10)
- buttonContainerGrid.HorizontalAlignment = Enum.HorizontalAlignment.Center
- buttonContainerGrid.VerticalAlignment = Enum.VerticalAlignment.Center
- buttonContainerGrid.Parent = mainWindowButtonContainer
- -- Main Window Buttons [Execute, Clear, Save File, Options, Discord]
- local executeButton = tonicMainWindow:AddButton("Execute", function()
- loadstring(mainWindowScriptInput.Text)()
- end)
- local clearButton = tonicMainWindow:AddButton("Clear", function()
- mainWindowScriptInput.Text = ""
- renderLines(1)
- end)
- local saveButton = tonicMainWindow:AddButton("Save File", function()
- local fileNames = {
- "BoxBox",
- "TonicBox",
- "BoxTonic",
- "RandomName",
- "ThisIsTonic",
- "BoxIsTonic",
- "BoxBoxTonic",
- "TonicTonicBox",
- "TonicBoxTonic",
- "ThisIsBox",
- "ThisBoxTonic"
- }
- local chars = "abcdefghijklmnopqrstuvwxyz"
- local chosen = fileNames[math.random(1, #fileNames)]
- local chosen2 = ""
- for i = 1, math.random(1, 3) do
- local chosen3 = math.random(1, chars:len())
- chosen2 = chosen2 .. chars:sub(chosen3, chosen3)
- end
- local filename = chosen..chosen2
- print("Saving file: "..filename..".lua")
- writefile(filename..".lua", mainWindowScriptInput.Text)
- end)
- local optionButton = tonicMainWindow:AddButton("Options", function()
- tonicOptionHub:ToggleVisibility()
- end)
- local scriptHubButton = tonicMainWindow:AddButton("Script Hub", function()
- tonicScriptHub:ToggleVisibility()
- end)
- local discordButton = tonicMainWindow:AddButton("Discord", function()
- print("Discord: xyzabcxyz")
- end)
- -- Colour Rendering
- local colourSettings = {
- ["PrimaryWindow"] = Color3.fromRGB(47, 47, 47),
- ["SecondaryWindow"] = Color3.fromRGB(47, 47, 47),
- ["Container"] = Color3.fromRGB(35, 35, 35),
- ["OptionTree"] = Color3.fromRGB(61, 61, 61),
- ["TitleBar"] = Color3.fromRGB(61, 61, 61)
- }
- function renderColours()
- local uiElements = ui:GetDescendants()
- for i,v in next, colourSettings do
- for i2,v2 in pairs(uiElements) do
- if v2.Name == i then
- v2.BackgroundColor3 = v
- end
- end
- end
- end
- -- Options Colours
- -- PrimaryWindow
- local colourContainer = tonicOptionHub:AddContainer(true, false)
- colourContainer.Size = UDim2.new(1,-10,0,35)
- colourContainer.Position = UDim2.new(0,5,0,35)
- colourContainer.BackgroundColor3 = Color3.fromRGB(53,53,53)
- local colourGrid = Instance.new("UIGridLayout")
- colourGrid.CellPadding = UDim2.new(0,0,0,0)
- colourGrid.CellSize = UDim2.new(0,5,0,5)
- colourGrid.StartCorner = Enum.StartCorner.TopLeft
- colourGrid.Parent = colourContainer
- for i = 1, 255 do
- local color = Color3.fromRGB(i,i,i)
- local colourButton = tonicOptionHub:AddColour(color, function(returned)
- colourSettings.PrimaryWindow = returned
- renderColours()
- end)
- colourButton.Parent = colourContainer
- end
- -- Secondary Window
- local colourContainer2 = tonicOptionHub:AddContainer(true, false)
- colourContainer2.Size = UDim2.new(1,-10,0,35)
- colourContainer2.Position = UDim2.new(0,5,0,70)
- colourContainer2.BackgroundColor3 = Color3.fromRGB(53,53,53)
- local colourGrid2 = Instance.new("UIGridLayout")
- colourGrid2.CellPadding = UDim2.new(0,0,0,0)
- colourGrid2.CellSize = UDim2.new(0,5,0,5)
- colourGrid2.StartCorner = Enum.StartCorner.TopLeft
- colourGrid2.Parent = colourContainer2
- for i = 1, 255 do
- local color = Color3.fromRGB(i,i,i)
- local colourButton2 = tonicOptionHub:AddColour(color, function(returned)
- colourSettings.SecondaryWindow = returned
- renderColours()
- end)
- colourButton2.Parent = colourContainer2
- end
- -- Container
- local colourContainer2a = tonicOptionHub:AddContainer(true, false)
- colourContainer2a.Size = UDim2.new(1,-10,0,35)
- colourContainer2a.Position = UDim2.new(0,5,0,105)
- colourContainer2a.BackgroundColor3 = Color3.fromRGB(53,53,53)
- local colourGrid2a = Instance.new("UIGridLayout")
- colourGrid2a.CellPadding = UDim2.new(0,0,0,0)
- colourGrid2a.CellSize = UDim2.new(0,5,0,5)
- colourGrid2a.StartCorner = Enum.StartCorner.TopLeft
- colourGrid2a.Parent = colourContainer2a
- for i = 1, 255 do
- local color = Color3.fromRGB(i,i,i)
- local colourButton2a = tonicOptionHub:AddColour(color, function(returned)
- colourSettings.Container = returned
- renderColours()
- end)
- colourButton2a.Parent = colourContainer2a
- end
- -- Option Tree
- local colourContainer2b = tonicOptionHub:AddContainer(true, false)
- colourContainer2b.Size = UDim2.new(1,-10,0,35)
- colourContainer2b.Position = UDim2.new(0,5,0,140)
- colourContainer2b.BackgroundColor3 = Color3.fromRGB(53,53,53)
- local colourGrid2b = Instance.new("UIGridLayout")
- colourGrid2b.CellPadding = UDim2.new(0,0,0,0)
- colourGrid2b.CellSize = UDim2.new(0,5,0,5)
- colourGrid2b.StartCorner = Enum.StartCorner.TopLeft
- colourGrid2b.Parent = colourContainer2b
- for i = 1, 255 do
- local color = Color3.fromRGB(i,i,i)
- local colourButton2b = tonicOptionHub:AddColour(color, function(returned)
- colourSettings.OptionTree = returned
- renderColours()
- end)
- colourButton2b.Parent = colourContainer2b
- end
- -- TitleBar
- local colourContainer2c = tonicOptionHub:AddContainer(true, false)
- colourContainer2c.Size = UDim2.new(1,-10,0,35)
- colourContainer2c.Position = UDim2.new(0,5,0,175)
- colourContainer2c.BackgroundColor3 = Color3.fromRGB(53,53,53)
- local colourGrid2c = Instance.new("UIGridLayout")
- colourGrid2c.CellPadding = UDim2.new(0,0,0,0)
- colourGrid2c.CellSize = UDim2.new(0,5,0,5)
- colourGrid2c.StartCorner = Enum.StartCorner.TopLeft
- colourGrid2c.Parent = colourContainer2c
- for i = 1, 255 do
- local color = Color3.fromRGB(i,i,i)
- local colourButton2c = tonicOptionHub:AddColour(color, function(returned)
- colourSettings.TitleBar = returned
- renderColours()
- end)
- colourButton2c.Parent = colourContainer2c
- end
- scriptHubButton.Parent, executeButton.Parent, clearButton.Parent, saveButton.Parent, optionButton.Parent, discordButton.Parent = mainWindowButtonContainer, mainWindowButtonContainer, mainWindowButtonContainer, mainWindowButtonContainer, mainWindowButtonContainer, mainWindowButtonContainer
- local target = mainWindowScriptInput
- local box = target
- function render(text)
- for i,v in pairs(target:GetChildren()) do
- if v:IsA("TextLabel") then
- v:Destroy()
- end
- end
- local getTokens = (lex(text))
- local tokens = {}
- for i,v in pairs(getTokens) do
- for i2,v2 in pairs(v) do
- table.insert(tokens, v2)
- end
- end
- local colours = {
- ["keyword"] = {
- Colour = Color3.fromRGB(249,38,114),
- Font = Enum.Font.SourceSansBold
- },
- ["operator"] = {
- Colour = Color3.fromRGB(248,248,242),
- },
- ["number"] = {
- Colour = Color3.fromRGB(174,129,255)
- },
- ["string_start"] = {
- Colour = Color3.fromRGB(230,219,90),
- Font = Enum.Font.SourceSansItalic
- },
- ["string_end"] = {
- Colour = Color3.fromRGB(230,219,90),
- Font = Enum.Font.SourceSansItalic
- },
- ["string"] = {
- Colour = Color3.fromRGB(230,219,90),
- Font = Enum.Font.SourceSansItalic
- },
- ["builtin"] = {
- Colour = Color3.fromRGB(102,217,239),
- Font = Enum.Font.SourceSansBold
- },
- ["comment"] = {
- Colour = Color3.fromRGB(121,121,121),
- Font = Enum.Font.SourceSansSemibold
- }
- }
- local position = UDim2.new(0,0,0,0)
- local prevline = 0
- local textsize = 18
- for i,v in pairs(tokens) do
- local line = v.line
- local text = v.data
- local pos1 = v.posFirst
- local pos2 = v.posLast
- local ttype = v.type
- local icheck = colours[ttype] and true or false
- local ccheck
- local fcheck
- if icheck then
- ccheck = colours[ttype].Colour and true or false
- fcheck = colours[ttype].Font and true or false
- else
- ccheck = false
- fcheck = false
- end
- local colour
- local font
- if ccheck then
- colour = colours[ttype].Colour
- else
- colour = Color3.fromRGB(255,255,255)
- end
- if fcheck then
- font = colours[ttype].Font
- else
- font = Enum.Font.SourceSans
- end
- if line ~= prevline then
- position = UDim2.new(0,0,0,line*textsize)
- end
- local tlabel = Instance.new("TextLabel")
- tlabel.Text = text
- tlabel.TextSize = textsize
- tlabel.TextColor3 = colour
- tlabel.Font = font
- tlabel.Position = position
- tlabel.BackgroundTransparency = 1
- tlabel.Parent = target
- local tbounds = tlabel.TextBounds
- tlabel.Size = UDim2.new(0,tbounds.x,0,20)
- position = position + UDim2.new(0,tbounds.x,0,0)
- prevline = line
- end
- end
- box:GetPropertyChangedSignal("Text"):Connect(function()
- render(box.Text)
- local textBounds = (mainWindowScriptInput.TextBounds.Y / 18)
- renderLines(textBounds)
- end)
Add Comment
Please, Sign In to add comment