Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local signal;
- local fakeEvent = {}
- local picker = {}
- if(not script:FindFirstChild'Panel')then
- game:GetObjects("rbxassetid://4881341304")[1]:Clone():WaitForChild'Panel'.Parent=script; -- for colorpicker later
- end
- do
- local ScriptConnection = {}
- function ScriptConnection.new(event,func,...)
- local connObj = newproxy(true)
- local conn = {
- Event=event;
- Function=func;
- Args={...};
- Object=connObj;
- }
- getmetatable(connObj).__index=function(self,index)
- if(index=='Locked')then
- return nil;
- else
- return conn[index] or ScriptConnection[index]
- end
- end
- getmetatable(connObj).__newindex=function(self,index,value)
- if(index=='Locked' and getfenv(2).script==script)then
- conn.Locked=value
- elseif(index~='Locked')then
- conn[index]=value
- end
- end
- return connObj;
- end
- function ScriptConnection:disconnect()
- self.Event._connections[self]=nil;
- end
- function ScriptConnection:Lock(key)
- self.Locked=key;
- end
- function ScriptConnection:Unlock(key)
- if(self.Locked==key)then
- self.Locked=nil;
- else
- error("Invalid key!",2)
- end
- end
- ScriptConnection.Disconnect=ScriptConnection.disconnect;
- setmetatable(ScriptConnection,{__call=function(s,...)ScriptConnection.new(...) end})
- signal = ScriptConnection.new;
- end
- do
- function fakeEvent.new()
- local conn = {
- _connections={};
- _yield={};
- }
- setmetatable(conn,{__index=fakeEvent})
- return conn;
- end
- function fakeEvent:fire(...)
- self._yield={};
- for i = 1,#self._connections do
- local connection = self._connections[i]
- coroutine.wrap(function(...) connection.Function(#connection.Args>0 and unpack(connection.Args) or ...) end)(...)
- end
- end
- function fakeEvent:connect(func,...)
- local obj = signal(self,func,...)
- table.insert(self._connections,obj)
- end
- function fakeEvent:wait()
- local guid = tostring(function() end):sub(13)
- self._yield[guid]=true;
- repeat wait() until self._yield[guid]~=true
- self._yield[guid]=nil;
- end
- fakeEvent.Fire=fakeEvent.fire;
- fakeEvent.Connect=fakeEvent.connect;
- fakeEvent.Wait=fakeEvent.wait;
- setmetatable(fakeEvent,{__call=fakeEvent.new})
- end
- do
- local function regPicker(obj)
- local panel = obj.Panel
- local hue = obj.Hue
- local colorEvent = obj.ColorChanged
- local connection;
- local hconnection;
- panel.InputBegan:connect(function(io)
- if(io.UserInputType==Enum.UserInputType.MouseButton1)then
- local y = math.clamp( io.Position.y - panel.AbsolutePosition.Y, 0, 128 )
- local x = math.clamp( io.Position.x - panel.AbsolutePosition.X, 0, 128 )
- obj.PSel.Position=UDim2.new(0,x,0,y)
- obj.s = x/128
- obj.v = 1-y/128
- colorEvent:fire(obj:Get())
- if(connection)then
- connection:disconnect()
- end
- connection = game:service'UserInputService'.InputChanged:Connect(function(io,gpe)
- if(io.UserInputType==Enum.UserInputType.MouseMovement)then
- local y = math.clamp( io.Position.y - panel.AbsolutePosition.Y, 0, 128 )
- local x = math.clamp( io.Position.x - panel.AbsolutePosition.X, 0, 128 )
- obj.PSel.Position=UDim2.new(0,x,0,y)
- obj.s = x/128
- obj.v = 1-y/128
- colorEvent:fire(obj:Get())
- end
- end)
- end
- end)
- hue.InputBegan:connect(function(io)
- if(io.UserInputType==Enum.UserInputType.MouseButton1)then
- local guiInset = game:service'GuiService':GetGuiInset()
- local y = math.clamp( io.Position.y - hue.AbsolutePosition.Y, 0, 128 )
- obj.HSel.Position=UDim2.new(0,0,0,y)
- obj.h = 1-y/128
- colorEvent:fire(obj:Get())
- if(connection)then
- connection:disconnect()
- end
- obj:UpdateDisplay()
- hconnection = game:service'UserInputService'.InputChanged:Connect(function(io,gpe)
- if(io.UserInputType==Enum.UserInputType.MouseMovement)then
- local y = math.clamp( io.Position.y - hue.AbsolutePosition.Y, 0, 128 )
- obj.HSel.Position=UDim2.new(0,0,0,y)
- obj.h = 1-y/128
- colorEvent:fire(obj:Get())
- obj:UpdateDisplay()
- end
- end)
- end
- end)
- game:service'UserInputService'.InputEnded:Connect(function(io,gpe)
- if(io.UserInputType==Enum.UserInputType.MouseButton1)then
- if(typeof(connection)=='RBXScriptConnection')then
- connection:disconnect()
- connection=nil
- end
- if(typeof(hconnection)=='RBXScriptConnection')then
- hconnection:disconnect()
- hconnection=nil
- end
- end
- end)
- end
- function picker.new()
- local p = script:WaitForChild'Panel':Clone()
- local selection = p:WaitForChild'selection'
- local h = p:WaitForChild'Hue'
- local hselection = h:WaitForChild'selection'
- local obj = {
- Panel = p;
- Hue = h;
- PSel = selection;
- HSel=hselection;
- ColorChanged=fakeEvent.new();
- h=0;
- s=0;
- v=1;
- UpdateDisplay=function(self)
- self.Panel.BackgroundColor3 = Color3.fromHSV(self.h,1,1)
- end;
- Set=function(self,c3)
- local h,s,v = Color3.toHSV(c3)
- self.h = h
- self.s = s
- self.v = v
- self.PSel.Position=UDim2.new(0,s*128,0,128-v*128)
- self.HSel.Position=UDim2.new(0,0,0,128-h*128)
- self.ColorChanged:fire(self:Get())
- self:UpdateDisplay()
- end;
- SetHSV=function(self,h,s,v)
- self.h = h
- self.s = s
- self.v = v
- self.PSel.Position=UDim2.new(0,s*128,0,128-v*128)
- self.HSel.Position=UDim2.new(0,0,0,128-h*128)
- self.ColorChanged:fire(self:Get())
- self:UpdateDisplay()
- end;
- Get=function(self)
- return Color3.fromHSV(self.h,self.s,self.v)
- end;
- GetHSV=function(self)
- return self.h,self.s,self.v
- end;
- }
- setmetatable(obj,picker)
- obj:Set(Color3.new(1,1,1))
- regPicker(obj);
- return obj;
- end
- picker.__index=picker;
- picker.__newindex=function(self,ind,val)
- local s,e = pcall(function()
- rawget(self,'Panel')[ind]=val;
- end)
- if(not s)then
- rawset(self,ind,val)
- end
- end
- end
- local newTabGUI=(function()
- local partsWithId = {}
- local awaitRef = {}
- local root = {
- ID = 0;
- Type = "ImageLabel";
- Properties = {
- ImageColor3 = Color3.new(49/255,77/255,97/255);
- ScaleType = Enum.ScaleType.Slice;
- BorderColor3 = Color3.new(9/85,14/85,53/255);
- BackgroundTransparency = 1;
- Size = UDim2.new(0,243,0,25);
- Image = "rbxassetid://3570695787";
- Name = "Frame";
- Position = UDim2.new(0,25,0,25);
- SliceScale = 0.25;
- ZIndex = 3;
- BackgroundColor3 = Color3.new(1,1,1);
- SliceCenter = Rect.new(Vector2.new(100,100),Vector2.new(100,100));
- };
- Children = {
- {
- ID = 1;
- Type = "TextLabel";
- Properties = {
- FontSize = Enum.FontSize.Size24;
- TextColor3 = Color3.new(1,1,1);
- Text = "Stinky";
- Font = Enum.Font.Highway;
- Name = "Title";
- BackgroundTransparency = 1;
- Size = UDim2.new(1,0,0.87999999523163,0);
- ZIndex = 4;
- TextSize = 24;
- BackgroundColor3 = Color3.new(1,1,1);
- };
- Children = {};
- };
- {
- ID = 2;
- Type = "Frame";
- Properties = {
- AnchorPoint = Vector2.new(0.5,0);
- Position = UDim2.new(0.5,0,0.5,0);
- Size = UDim2.new(1,-10,0,100);
- BorderSizePixel = 0;
- BackgroundColor3 = Color3.new(9/85,14/85,53/255);
- };
- Children = {
- {
- ID = 3;
- Type = "ImageLabel";
- Properties = {
- ImageColor3 = Color3.new(9/85,14/85,53/255);
- ScaleType = Enum.ScaleType.Slice;
- BackgroundTransparency = 1;
- AnchorPoint = Vector2.new(0.5,0.5);
- Image = "rbxassetid://3570695787";
- Name = "Border";
- Position = UDim2.new(0.5,0,0.5,0);
- SliceScale = 0.050000000745058;
- Size = UDim2.new(1,10,1,10);
- BackgroundColor3 = Color3.new(1,1,1);
- SliceCenter = Rect.new(Vector2.new(100,100),Vector2.new(100,100));
- };
- Children = {};
- };
- {
- ID = 4;
- Type = "Frame";
- Properties = {
- AnchorPoint = Vector2.new(0.5,0);
- Position = UDim2.new(0.5,0,0,0);
- Name = "ListContainer";
- ClipsDescendants = true;
- BackgroundTransparency = 1;
- Size = UDim2.new(1,10,1,5);
- BorderSizePixel = 0;
- BackgroundColor3 = Color3.new(9/85,14/85,53/255);
- };
- Children = {
- {
- ID = 5;
- Type = "ScrollingFrame";
- Properties = {
- BackgroundTransparency = 1;
- Name = "List";
- Position = UDim2.new(0,0,0,15);
- BorderColor3 = Color3.new(9/85,14/85,53/255);
- Size = UDim2.new(1,0,0,85);
- BorderSizePixel = 0;
- BackgroundColor3 = Color3.new(9/85,14/85,53/255);
- };
- Children = {
- {
- ID = 6;
- Type = "UIListLayout";
- Properties = {
- SortOrder = Enum.SortOrder.LayoutOrder;
- Padding=UDim.new(0,5);
- };
- Children = {};
- };
- };
- };
- };
- };
- };
- };
- };
- };
- local function Scan(item, parent)
- local obj = Instance.new(item.Type)
- if (item.ID) then
- local awaiting = awaitRef[item.ID]
- if (awaiting) then
- awaiting[1][awaiting[2]] = obj
- awaitRef[item.ID] = nil
- else
- partsWithId[item.ID] = obj
- end
- end
- for p,v in pairs(item.Properties) do
- if (type(v) == "string") then
- local id = tonumber(v:match("^_R:(%w+)_$"))
- if (id) then
- if (partsWithId[id]) then
- v = partsWithId[id]
- else
- awaitRef[id] = {obj, p}
- v = nil
- end
- end
- end
- obj[p] = v
- end
- for _,c in pairs(item.Children) do
- Scan(c, obj)
- end
- obj.Parent = parent
- return obj
- end
- return function() return Scan(root, nil) end
- end)()
- local newTextlessSeperator=(function()
- local partsWithId = {}
- local awaitRef = {}
- local root = {
- ID = 0;
- Type = "Frame";
- Properties = {
- AnchorPoint = Vector2.new(0.5,0.5);
- Name = "Sep";
- Position = UDim2.new(0.5,0,0.5,0);
- BorderColor3 = Color3.new(9/85,14/85,53/255);
- ZIndex = 2;
- Size = UDim2.new(1,10,0,5);
- BackgroundColor3 = Color3.new(47/255,74/255,94/255);
- };
- Children = {};
- };
- local function Scan(item, parent)
- local obj = Instance.new(item.Type)
- if (item.ID) then
- local awaiting = awaitRef[item.ID]
- if (awaiting) then
- awaiting[1][awaiting[2]] = obj
- awaitRef[item.ID] = nil
- else
- partsWithId[item.ID] = obj
- end
- end
- for p,v in pairs(item.Properties) do
- if (type(v) == "string") then
- local id = tonumber(v:match("^_R:(%w+)_$"))
- if (id) then
- if (partsWithId[id]) then
- v = partsWithId[id]
- else
- awaitRef[id] = {obj, p}
- v = nil
- end
- end
- end
- obj[p] = v
- end
- for _,c in pairs(item.Children) do
- Scan(c, obj)
- end
- obj.Parent = parent
- return obj
- end
- return function() return Scan(root, nil) end
- end)()
- local player = game:service'Players'.localPlayer;
- local plrGui = player:FindFirstChildOfClass'PlayerGui'
- local textService = game:service'TextService'
- local resources = game:service'RunService':IsStudio() and require(script:WaitForChild'RoStrap') or loadstring(game:HttpGet"https://pastebin.com/raw/nV4Kh274")()
- local pInstance = resources:LoadLibrary'PseudoInstance'
- local Color = resources:LoadLibrary'Color'
- local drag = game:service'RunService':IsStudio() and require(script:WaitForChild'Drag') or loadstring(game:HttpGet'https://pastebin.com/raw/LgeCDbAX')()
- local library = {}
- local themeOptions = setmetatable({DisabledModuleColor=Color3.new(1,0,0);EnabledModuleColor=Color3.new(0,1,0);TabTitleColor=Color.White;TextColor3=Color.White;TabColor=Color3.fromRGB(61,21,133);ContentColor=Color3.fromRGB(27,42,53)},{__mode='k'})
- local readonlyProperties={
- Visible=false;
- ThemeSettings=setmetatable({},{__index=themeOptions,__newindex=function()return error'no.'end});
- };
- function Tween(obj,props,time,easing,direction,repeats,backwards)
- local info = TweenInfo.new(time or .5, easing or Enum.EasingStyle.Quad, direction or Enum.EasingDirection.Out, repeats or 0, backwards or false)
- local tween = game:service'TweenService':Create(obj, info, props)
- tween:Play()
- end
- library.GUI = Instance.new("ScreenGui",game:service'RunService':IsStudio() and plrGui or game.CoreGui)
- library.GUI.DisplayOrder=100
- library.GUI.ResetOnSpawn=false
- library.GUI.IgnoreGuiInset=true
- library.GUI.ZIndexBehavior=Enum.ZIndexBehavior.Global
- library.Tabs={}
- library.TabObject = {};
- setmetatable(library.TabObject,{__index=library})
- setmetatable(library,{__index=readonlyProperties,__metatable=bm==bad})
- local NextTabPos = UDim2.new(0,0,0,0)
- local internalStuff = {}
- local errors = {
- unableToCast="Unable to cast %s to %s"
- }
- function expectType(got,expected)
- return typeof(got)==expected,errors.unableToCast:format(typeof(got),expected)
- end
- function library:SetVisibility(value)
- readonlyProperties.Visible=value
- library:UpdateTabs()
- end
- function library.TabObject:Update()
- self:UpdateTabs()
- self:UpdateScroll()
- self:TweenSize()
- end
- function library:UpdateTabs()
- for i = 1,#self.Tabs do
- local obj = self.Tabs[i]
- if(obj and obj.UI)then
- obj.UI.ImageColor3=self.ThemeSettings.TabColor
- obj.UI:WaitForChild'Frame':WaitForChild'Border'.ImageColor3=self.ThemeSettings.ContentColor
- obj.UI.Visible=self.Visible
- end
- end
- end
- function library:SetTabColor(c3)
- assert(expectType(c3,'Color3'))
- themeOptions.TabColor=c3
- end
- function library:SetContentColor(c3)
- assert(expectType(c3,'Color3'))
- themeOptions.ContentColor=c3
- end
- function library.TabObject:SetModulesVisibility(value)
- self.Visibility=value
- self:TweenSize()
- end
- function library.TabObject:UpdateScroll()
- self.UI.Frame.ListContainer.List.Size=UDim2.new(1,0,0,self:GetHeight())
- self.UI.Frame.ListContainer.List.CanvasSize=UDim2.new(0,0,0,self:GetHeight())
- end
- function library.TabObject:GetHeight()
- local y=0;
- for i = 1,#self.Children do
- y=y+self.Children[i].Element.AbsoluteSize.Y+5
- end
- return y
- end
- function library.TabObject:GetSize()
- return UDim2.new(1,-10,0,math.min(self:GetHeight(),500)+15)
- end
- function library.TabObject:TweenSize()
- if(self.Visibility)then
- self.UI.Frame:TweenSize(self:GetSize(),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,.2,true)
- else
- self.UI.Frame:TweenSize(UDim2.new(1,-10,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Sine,.2,true)
- end
- end
- function library.TabObject:NewButton(name,callback)
- if(callback)then assert(expectType(callback,'function'))end
- local button = pInstance.new("RippleButton")
- button.Size=UDim2.new(1,0,0,25)
- button.Object.Active=false
- button.Text=name
- button.Font=Enum.Font.Highway
- button.TextSize=24
- button.ZIndex=4
- button.PrimaryColor3 = self.ThemeSettings.TextColor3
- button.Parent=self.UI.Frame.ListContainer.List
- if(callback)then
- button.OnPressed:Connect(callback)
- end
- table.insert(self.Children,{Type='Button';Element=button.Object})
- self:Update()
- return button;
- end
- function library.TabObject:NewSeperator(text)
- local sep = newTextlessSeperator()
- local h,s,v = Color3.toHSV(self.ThemeSettings.ContentColor)
- local v = v<=.5 and v*1.5 or v/1.5
- sep.BackgroundColor3 = Color3.fromHSV(h,s,v)
- sep.Parent=self.UI.Frame.ListContainer.List
- table.insert(self.Children,{Type='Seperator';Element=sep})
- self:Update()
- return sep;
- end
- function library.TabObject:NewLabel(text)
- assert(expectType(text,"string"))
- local txt = Instance.new("TextLabel")
- txt.Size=UDim2.new(1,0,0,25)
- txt.Text=text
- txt.Font=Enum.Font.Highway
- txt.TextSize=24
- txt.ZIndex=4
- txt.BackgroundTransparency=1
- txt.TextColor3=self.ThemeSettings.TextColor3
- txt.Parent=self.UI.Frame.ListContainer.List
- table.insert(self.Children,{Type='TextLabel';Element=txt})
- self:Update()
- return setmetatable({},{__index=function(s,i)
- if(i:sub(1,3)=='Set')then
- local prop = i:sub(4)
- return function(...)
- txt[prop]=...
- end
- else
- return txt[i]
- end
- end},{__newindex=function(s,i,v) txt[i]=v end})
- end
- function library.TabObject:NewToggle(text,callback,defaultVal)
- local text = text or 'ExampleMod'
- if(callback)then assert(expectType(callback,'function'))end
- if(text)then assert(expectType(text,'string'))end
- local button = Instance.new("TextButton")
- button.Size=UDim2.new(1,0,0,25)
- button.Active=false
- button.Text=text
- button.Font=Enum.Font.Highway
- button.TextSize=24
- button.ZIndex=4
- button.BackgroundTransparency = 1
- button.Parent=self.UI.Frame.ListContainer.List
- local Object = {Toggled=false;Type='Toggle';Element=button}
- setmetatable(Object,{__index=library})
- function Object:Toggle(tog)
- self.Toggled = tog or not self.Toggled
- Tween(button,{TextColor3 = (self.Toggled and self.ThemeSettings.EnabledModuleColor or self.ThemeSettings.DisabledModuleColor)},.1,Enum.EasingStyle.Linear)
- if(callback)then callback(self.Toggled)end
- end
- button.TextColor3 = self.ThemeSettings.DisabledModuleColor
- button.MouseButton1Down:Connect(function()Object:Toggle()end)
- table.insert(self.Children,Object)
- self:Update()
- Object:Toggle(not not defaultVal)
- return Object;
- end
- function library.TabObject:NewTextbox(defaultValue,placeholderText)
- local h,s,v = Color3.toHSV(self.ThemeSettings.ContentColor)
- local v = v<=.5 and v*1.5 or v/1.5
- local textBox = Instance.new("TextBox")
- textBox.TextWrapped = true
- textBox.TextColor3 = Color3.new(1,1,1)
- textBox.Text = defaultValue and tostring(defaultValue) or ''
- textBox.PlaceholderText = placeholderText and tostring(placeholderText) or ''
- textBox.Font = Enum.Font.Highway
- textBox.FontSize = Enum.FontSize.Size24
- textBox.Size = UDim2.new(1,0,0,25)
- textBox.TextSize = 24
- textBox.BackgroundColor3 = Color3.fromHSV(h,s,v)
- textBox.TextScaled = true
- textBox.Parent = self.UI.Frame.ListContainer.List
- table.insert(self.Children,{Type='Textbox';Element=textBox})
- self:Update()
- return textBox
- end
- function library:NewTab(name)
- local name = name or "TextLabel"
- local textSize = textService:GetTextSize(name,24,Enum.Font.Highway,Vector2.new(9e9,9e9))
- local ui = newTabGUI()
- ui.Position = NextTabPos+UDim2.new(0,0,0,36)
- ui.Name=name
- ui.Size=UDim2.new(0,math.max(textSize.X,230),0,ui.Size.Y.Offset)
- NextTabPos=NextTabPos+UDim2.new(0,ui.Size.X.Offset+10,0,0)
- ui:WaitForChild'Title'.Text = name
- ui.ImageColor3=self.ThemeSettings.TabColor
- ui.Title.TextColor3=self.ThemeSettings.TabTitleColor
- ui:WaitForChild'Frame':WaitForChild'Border'.ImageColor3=self.ThemeSettings.ContentColor
- ui.Visible=self.Visible
- local tabObj = setmetatable({Visibility=true;UI=ui,Children={},Dragger=drag:Connect(ui)},{__index=self.TabObject})
- tabObj.Dragger:SetDragTime(.1)
- ui.Frame.Size = tabObj:GetSize()
- ui.InputEnded:connect(function(io,gpe)
- if(gpe)then return end
- if(io.UserInputType==Enum.UserInputType.MouseButton2)then
- tabObj:SetModulesVisibility(not tabObj.Visibility)
- end
- end)
- ui.Parent=self.GUI;
- tabObj:Update()
- table.insert(self.Tabs,tabObj)
- return tabObj
- end
- return library
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement