nij55

Django

Nov 28th, 2020
563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.71 KB | None | 0 0
  1. --[[ Made by Nij55 #9484
  2. JCFs stands for James' Custom Functions]]
  3.  
  4. -- Variables
  5. local ObjectElements = {Storage = {}, Templates = {}}
  6. local EntryStorage = {}
  7. local JCFs = {Enabled = true, Version = '0.0.3'}
  8.  
  9. local Colors = {Foreground = Color3.fromRGB(32,32,32),
  10. Background = Color3.fromRGB(22,22,22),
  11. Button = Color3.fromRGB(47,47,47),
  12. TextBox = Color3.fromRGB(18,18,18),
  13. Text1 = Color3.new(1,1,1),
  14. Accent = Color3.fromRGB(227,0,140),
  15. TextSelect = Color3.fromRGB(153,153,153)}
  16.  
  17.  
  18. -- Services
  19. local Services = setmetatable({}, {
  20.     __index = function(self,Index)
  21.         if pcall(function() game:GetService(Index) end) then
  22.             return game:GetService(Index)
  23.         else
  24.             return
  25.         end
  26.     end
  27. })
  28.  
  29. -- New Object
  30. function New(Object,ObjectProperties,Third)
  31.     if not JCFs.Enabled then return end
  32.     if type(Object) == 'string' and type(ObjectProperties) == 'table' then
  33. 11111111111111111111111111      if Object:sub(1,3) == 'Dj-' then
  34.             for FuncName, Function in pairs(ObjectElements.Templates) do
  35.                 if Object:sub(4) == FuncName then return Function(ObjectProperties,Third) end
  36.             end
  37.         else
  38.             local CreatedInstance = Instance.new(Object)
  39.             for Prop,PropVal in pairs(ObjectProperties) do
  40.                 CreatedInstance[Prop] = PropVal
  41.             end
  42.             return CreatedInstance
  43.         end
  44.     end
  45. end
  46.  
  47. -- Pre Configuration & Variables
  48. local Mode = 'Compatible'
  49. local DjangoHolder
  50. local SynapseBeta
  51. local KrnlLoaded
  52. local LocalPlayer = Services.Players.LocalPlayer
  53. local Mouse = LocalPlayer:GetMouse()
  54. pcall(function() SynapseBeta = syn.is_beta() end)
  55. pcall(function() KrnlLoaded = KRNL_LOADED end)
  56. if Services.RunService:IsStudio() then
  57.     Mode = 'Studio'
  58. elseif KrnlLoaded == true or KrnlLoaded == false then
  59.     print("Django - You're using Krnl.")
  60.     Mode = 'Advanced'
  61. elseif SynapseBeta == true or SynapseBeta == false then
  62.     print("Django - You're using Synapse.")
  63.     Mode = 'Advanced'  
  64. end
  65.  
  66. if Mode == 'Advanced' then
  67.     Services.CoreGui.RobloxPromptGui.ResetOnSpawn = false
  68.     Services.CoreGui.RobloxPromptGui.IgnoreGuiInset = true
  69. end
  70.  
  71. -- UI Configuration
  72. if Mode == 'Compatible' or Mode == 'Studio' then
  73.     DjangoHolder = New('ScreenGui',{Parent = LocalPlayer.PlayerGui, Name = 'Django Main', DisplayOrder = 2147483647, ZIndexBehavior = Enum.ZIndexBehavior.Global, ResetOnSpawn = false, IgnoreGuiInset = true})
  74. elseif Mode == 'Advanced' then
  75.     DjangoHolder = New('Folder',{Parent = Services.CoreGui.RobloxPromptGui, Name = 'Django Main'})
  76.     Services.CoreGui.RobloxPromptGui.ResetOnSpawn = false
  77.     Services.CoreGui.RobloxPromptGui.IgnoreGuiInset = true
  78. end
  79.  
  80. -- Color Stuff
  81. function JCFs.RefreshColors()
  82.     if not JCFs.Enabled then return end
  83.     for ObjectName, Object in pairs(ObjectElements.Storage) do
  84.         for ObjectProperty, Color in pairs(Object.Colors) do
  85.             Object.Instance[ObjectProperty] = Colors[Color]
  86.         end
  87.     end  
  88. end
  89.  
  90. --  Scale Text
  91. function JCFs.ScaleText(TextInst,Size)
  92.     if not JCFs.Enabled then return end
  93.     TextInst:GetPropertyChangedSignal('AbsoluteSize'):Connect(function()
  94.         if not JCFs.Enabled then return end
  95.         TextInst.TextScaled = false
  96.         TextInst.TextSize = math.ceil(TextInst.AbsoluteSize.Y * Size)
  97.         if TextInst.TextFits then
  98.             TextInst.TextScaled = false
  99.         else
  100.             TextInst.TextScaled = true
  101.         end
  102.     end)
  103.     TextInst.TextSize = math.ceil(TextInst.AbsoluteSize.Y * Size)
  104.     if TextInst.TextFits then
  105.         TextInst.TextScaled = false
  106.     else
  107.         TextInst.TextScaled = true
  108.     end
  109. end
  110.  
  111. -- Log
  112. function JCFs.Log(NewObject)
  113.     if not JCFs.Enabled then return end
  114.     ObjectElements.Storage[NewObject.Instance.Name] = NewObject
  115. end
  116.  
  117.  
  118. -- Key Gen
  119. function JCFs.KeyGen(Length,NumbersEnabled,SpecialsEnabled,CapsEnabled)
  120.     if not JCFs.Enabled then return end
  121.     local Letters = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}
  122.     local Specials = {"!","@","#","$","%","^","&","*","(",")","_","-","=","+","[","]","{","}",";",":","'","",",",".","?","<",">","/","|","`","~","\""}                                                  
  123.     local GeneratedString = ""
  124.     local FullArray = {}
  125.     if Length < 0 then
  126.         return GeneratedString
  127.     end
  128.     local SiftedAmount = 0
  129.     for i, v in pairs(Letters) do
  130.         table.insert(FullArray,v)
  131.     end
  132.     if CapsEnabled then
  133.         for i, v in pairs(Letters) do
  134.             table.insert(FullArray,string.upper(v))
  135.         end
  136.     end
  137.     if SpecialsEnabled then
  138.         for i, v in pairs(Specials) do
  139.             table.insert(FullArray,v)
  140.         end
  141.     end
  142.     if NumbersEnabled then
  143.         table.insert(FullArray,0)  
  144.         local NumbersAdded = 0
  145.         while NumbersAdded > 9 do
  146.             table.insert(FullArray,NumbersAdded +1)
  147.         end
  148.     end
  149.     while SiftedAmount < Length do
  150.         local SelectedChar = math.random(1,#FullArray)
  151.         GeneratedString = GeneratedString..FullArray[SelectedChar]
  152.         SiftedAmount = SiftedAmount +1
  153.     end
  154.     return GeneratedString
  155. end
  156.  
  157. -- Draggable
  158. function JCFs.EnableDrag(FrameMove,FrameDrag)
  159.     if not JCFs.Enabled then return end
  160.     local FrameDragging = false
  161.     local FrameDragStartPoint = nil
  162.     local FrameStartPoint = nil
  163.  
  164.     Mouse.Button1Up:Connect(function()
  165.         FrameDragging = false
  166.     end)
  167.  
  168.     Mouse.Move:Connect(function()
  169.         if FrameDragging and JCFs.Enabled then
  170.             local Delta = FrameDragStartPoint - Vector2.new(Mouse.X,Mouse.Y)
  171.             FrameMove.Instance:TweenPosition(UDim2.new(FrameStartPoint.X.Scale,FrameStartPoint.X.Offset - Delta.X,FrameStartPoint.Y.Scale,FrameStartPoint.Y.Offset - Delta.Y),'InOut','Bounce',0.1,true)
  172.         end
  173.     end)
  174.     FrameDrag.Instance.InputBegan:Connect(function(Input)
  175.         if Input.UserInputType == Enum.UserInputType.MouseButton1 and JCFs.Enabled then
  176.             FrameDragging = true
  177.             FrameStartPoint = FrameMove.Instance.Position
  178.             FrameDragStartPoint = Vector2.new(Mouse.X,Mouse.Y)
  179.         end
  180.     end)
  181.  
  182.     FrameDrag.Instance.InputEnded:Connect(function(Input)
  183.         if Input.UserInputType == Enum.UserInputType.MouseButton1 and JCFs.Enabled then
  184.             FrameDragging = false
  185.         end
  186.     end)
  187. end
  188.  
  189. -- Remove Function
  190. function JCFs.Remove(Object)
  191.     Object.Instance:Destroy()
  192.     ObjectElements.Storage[Object] = nil
  193. end
  194.  
  195. -- Print Objects
  196. function JCFs.PrintObjects()
  197.     for Pos,Obj in pairs(ObjectElements.Storage) do
  198.         print(Obj.Instance.Name)
  199.     end
  200. end
  201.  
  202. -- Exit Function
  203. function JCFs.Exit()
  204.     JCFs.Enabled = false
  205.     DjangoHolder:Destroy()
  206.     script:Destroy() -- May work sometimes
  207. end
  208.  
  209. -- Template Function - TextLabel
  210. function ObjectElements.Templates.TextLabel(ObjectProperties)
  211.     local NewObject = {Colors = {TextColor3 = 'Text1'}, Instance = New('TextLabel', {BackgroundTransparency = 1, Text = 'Text', Font = Enum.Font.SourceSansBold})}
  212.     local Name = 'DjangoObject'..JCFs.KeyGen(8,false,false,true)
  213.     for Prop, PropVal in pairs(ObjectProperties) do
  214.         if Prop == 'Name' then
  215.             Name = PropVal
  216.         elseif Prop == 'FixText' then
  217.             JCFs.ScaleText(NewObject.Instance,PropVal)
  218.         else
  219.             NewObject.Instance[Prop] = PropVal
  220.         end
  221.     end
  222.     NewObject.Instance.Name = Name
  223.     JCFs.Log(NewObject)
  224.     return NewObject
  225. end
  226.  
  227. -- Template Function - Button
  228. function ObjectElements.Templates.Button(ObjectProperties)
  229.     local NewObject = {Colors = {TextColor3 = 'Text1', BackgroundColor3 = 'Button', BorderColor3 = 'Text1'}, Instance = New('TextButton', {Font = 'SourceSansSemibold', BorderMode = 'Inset', BorderSizePixel = 1, AutoButtonColor = false})}
  230.     local Name = 'DjangoObject'..JCFs.KeyGen(8,false,false,true)
  231.     for Prop, PropVal in pairs(ObjectProperties) do
  232.         if Prop == 'Name' then
  233.             Name = PropVal
  234.         elseif Prop == 'FixText' then
  235.             JCFs.ScaleText(NewObject.Instance,PropVal)
  236.         else
  237.             NewObject.Instance[Prop] = PropVal
  238.         end
  239.     end
  240.     NewObject.Instance.MouseEnter:Connect(function()
  241.         NewObject.Instance.BackgroundColor3 = Colors.ButtonHover
  242.     end)
  243.  
  244.     NewObject.Instance.MouseLeave:Connect(function()
  245.         NewObject.Instance.BackgroundColor3 = Colors.Foreground
  246.     end)
  247.  
  248.     NewObject.Instance.MouseButton1Down:Connect(function()
  249.         NewObject.Instance.BackgroundColor3 = Colors.ButtonSelect
  250.     end)
  251.  
  252.     NewObject.Instance.MouseButton1Up:Connect(function()
  253.         NewObject.Instance.BackgroundColor3 = Colors.ButtonHover
  254.     end)
  255.     NewObject.Instance.Name = Name
  256.     JCFs.Log(NewObject)
  257.     return NewObject
  258. end
  259.  
  260. -- Template Function - Frame
  261. function ObjectElements.Templates.Frame(ObjectProperties)
  262.     local NewObject = {Colors = {BackgroundColor3 = 'Foreground'}, Instance = New('Frame', {BorderSizePixel = 0})}
  263.     local Name = 'DjangoObject'..JCFs.KeyGen(8,false,false,true)
  264.     for Prop, PropVal in pairs(ObjectProperties) do
  265.         if Prop == 'Name' then
  266.             Name = PropVal
  267.         elseif Prop == 'Color' then
  268.             NewObject.Colors.BackgroundColor3 = PropVal
  269.         else
  270.             NewObject.Instance[Prop] = PropVal
  271.         end
  272.     end
  273.     NewObject.Instance.Name = Name
  274.     JCFs.Log(NewObject)
  275.     return NewObject
  276. end
  277.  
  278. -- Template Function - TextBox
  279. function ObjectElements.Templates.TextBox(ObjectProperties)
  280.     local NewObject = {Colors = {BackgroundColor3 = 'TextBox', TextColor3 = 'Text1', BorderColor3 = 'TextSelect'}, Instance = New('TextBox', {Font = Enum.Font.SourceSansBold, BorderMode = 'Inset', BorderSizePixel = 1})}
  281.     local Name = 'DjangoObject'..JCFs.KeyGen(8,false,false,true)
  282.     local Text = 'Text'
  283.     for Prop, PropVal in pairs(ObjectProperties) do
  284.         if Prop == 'Name' then
  285.             Name = PropVal
  286.         elseif Prop == 'FixText' then
  287.             JCFs.ScaleText(NewObject.Instance,PropVal)
  288.         elseif Prop == 'Text' then
  289.             HoldingText = PropVal
  290.         else
  291.             NewObject.Instance[Prop] = PropVal
  292.         end
  293.     end
  294.     NewObject.Instance.Focused:Connect(function()
  295.         NewObject.Instance.Text = ''
  296.         NewObject.Instance.BorderColor3 = Colors.Accent
  297.     end)
  298.  
  299.     NewObject.Instance.FocusLost:Connect(function()
  300.         NewObject.Instance.Text = HoldingText
  301.         NewObject.Instance.BorderColor3 = Colors.TextSelect
  302.     end)
  303.     NewObject.Instance.Text = HoldingText
  304.     NewObject.Instance.Name = Name
  305.     JCFs.Log(NewObject)
  306.     return NewObject
  307. end
  308.  
  309. -- Template Function - RibbonButton
  310. function ObjectElements.Templates.RibbonButton(ObjectProperties)
  311.     NewObject = New('Dj-TextLabel', {Name = ObjectProperties.Name..'RibbonButton', Parent = ObjectElements.Storage.MFRibbon.Instance, ZIndex = 10003, LayoutOrder = 0, FixText = 0.9, Font = Enum.Font.SourceSansLight, BorderSizePixel = 0, Text = ObjectProperties.Name})
  312.     for Prop, PropVal in pairs(ObjectProperties) do
  313.         if Prop == 'Name' then
  314.         else
  315.             NewObject.Instance[Prop] = PropVal
  316.         end
  317.     end
  318.  
  319.     NewObject.Instance.Size = UDim2.new(0,Services.TextService:GetTextSize(ObjectProperties.Name,18,Enum.Font.SourceSansLight,Vector2.new(2147483647,20)).X +8,0,20)
  320.  
  321.     NewObject.Instance.MouseEnter:Connect(function()
  322.         NewObject.Instance.BackgroundColor3 = Colors.Background
  323.         NewObject.Instance.BackgroundTransparency = 0.6
  324.     end)
  325.  
  326.     NewObject.Instance.MouseLeave:Connect(function()
  327.         NewObject.Instance.BackgroundColor3 = Colors.Background
  328.         NewObject.Instance.BackgroundTransparency = 1
  329.     end)
  330.  
  331.     NewObject.Instance.InputBegan:Connect(function(Input)
  332.         if Input.UserInputType == Enum.UserInputType.MouseButton1 and JCFs.Enabled then
  333.             NewObject.Instance.BackgroundColor3 = Colors.Background
  334.             NewObject.Instance.BackgroundTransparency = 0
  335.         end
  336.     end)
  337.  
  338.     NewObject.Instance.InputEnded:Connect(function(Input)
  339.         if Input.UserInputType == Enum.UserInputType.MouseButton1 and JCFs.Enabled then
  340.             NewObject.Instance.BackgroundColor3 = Colors.Background
  341.             NewObject.Instance.BackgroundTransparency = 0.6
  342.         end
  343.     end)
  344.     return NewObject
  345. end
  346.  
  347. -- Instances
  348. New('Dj-Frame',{Name = 'MainFrame', Parent = DjangoHolder, Size = UDim2.new(0,700,0,400), Position = UDim2.new(0.5,-350,0.5,-200), ZIndex = 10000, Color = 'Background'})
  349. New('Dj-Frame',{Name = 'MFTopBar', Parent = ObjectElements.Storage.MainFrame.Instance, Size = UDim2.new(1,0,0,45), ZIndex = 10001})
  350. New('Dj-TextLabel', {Name = 'MFTopBarLabel' , Parent = ObjectElements.Storage.MFTopBar.Instance, FixText = 0.7, Position = UDim2.new(0,44,0,5), Size = UDim2.new(1,-40,0,35), ZIndex = 10002, Text = 'Django version - '..JCFs.Version, Font = Enum.Font.SourceSans})
  351. JCFs.Log({Colors = {}, Instance = New('ImageLabel', {BackgroundTransparency = 1, Parent = ObjectElements.Storage.MFTopBar.Instance, Name = 'MFExitButton', ZIndex = 10003, Size = UDim2.new(0,13,0,13), Position = UDim2.new(1,-27,0,6), Image = 'http://www.roblox.com/asset/?id=5919834396'})})
  352. New('Dj-Frame',{Name = 'MFExitButtonBack', Parent = ObjectElements.Storage.MFTopBar.Instance, Size = UDim2.new(0,39,0,23), BackgroundTransparency = 1, ZIndex = 10002, Position = UDim2.new(1,-40,0,1), Color = 'Background'})
  353. JCFs.Log({Colors = {}, Instance = New('ImageLabel', {BackgroundTransparency = 1, Parent = ObjectElements.Storage.MFTopBar.Instance, Name = 'DjangoMFLogo', ZIndex = 10002, Size = UDim2.new(0,39,0,39), Position = UDim2.new(0,3,0,3), Image = 'http://www.roblox.com/asset/?id=5920047288'})})
  354. New('Dj-Frame',{Name = 'MFBottomBar', Parent = ObjectElements.Storage.MainFrame.Instance, Size = UDim2.new(1,0,0,35), Position = UDim2.new(0,0,1,-35), ZIndex = 10001})
  355. New('Dj-TextLabel', {Name = 'MFBottomBarLabel', Parent = ObjectElements.Storage.MFBottomBar.Instance, FixText = 0.8, Size = UDim2.new(1,0,1,0), ZIndex = 10002, Text = 'Press F8 to open and close.', Font = Enum.Font.SourceSans})
  356. New('Dj-Frame', {Name = 'MFRibbon', Parent = ObjectElements.Storage.MainFrame.Instance, ZIndex = 10001, Size = UDim2.new(1,0,0,20), Position = UDim2.new(0,0,0,45)})
  357. JCFs.Log({Colors = {}, Instance = New('UIListLayout', {Parent = ObjectElements.Storage.MFRibbon.Instance,Name = 'MFRibbonLayout', Padding = UDim.new(0,0), FillDirection = 'Horizontal', SortOrder = 'LayoutOrder'})})
  358. New('Dj-RibbonButton', {Name = 'Commands'})
  359. New('Dj-Frame', {Name = 'CommandsMenu', ZIndex = 10001, Parent = ObjectElements.Storage.MainFrame.Instance, Size = UDim2.new(1,0,0,300), Position = UDim2.new(0,0,0,65), Color = 'Background'})
  360. New('Dj-TextBox', {Name = 'CommandBar', Parent = ObjectElements.Storage.CommandsMenu.Instance, Size = UDim2.new(1,0,0,25), FixText = 0.65, Text = 'Click or press \\ to execute a command.', ZIndex = 10002, Font = Enum.Font.Ubuntu})
  361.  
  362. -- Window Functions
  363. JCFs.EnableDrag(ObjectElements.Storage.MainFrame,ObjectElements.Storage.MFTopBar)
  364.  
  365. ObjectElements.Storage.MFExitButtonBack.Instance.MouseEnter:Connect(function()
  366.     ObjectElements.Storage.MFExitButtonBack.Instance.BackgroundTransparency = 0.6
  367. end)
  368.  
  369. ObjectElements.Storage.MFExitButtonBack.Instance.MouseLeave:Connect(function()
  370.     ObjectElements.Storage.MFExitButtonBack.Instance.BackgroundTransparency = 1
  371. end)
  372.  
  373. ObjectElements.Storage.MFExitButtonBack.Instance.InputBegan:Connect(function(Input)
  374.     if Input.UserInputType == Enum.UserInputType.MouseButton1 and JCFs.Enabled then
  375.         ObjectElements.Storage.MFExitButtonBack.Instance.BackgroundTransparency = 0
  376.     end
  377. end)
  378.  
  379. ObjectElements.Storage.MFExitButtonBack.Instance.InputEnded:Connect(function(Input)
  380.     if Input.UserInputType == Enum.UserInputType.MouseButton1 and JCFs.Enabled then
  381.         ObjectElements.Storage.MFExitButtonBack.Instance.BackgroundTransparency = 0.6
  382.         JCFs.Exit()
  383.     end
  384. end)
  385.  
  386. -- Key Functions
  387. Services.UserInputService.InputBegan:Connect(function(Input)
  388.     if Input.KeyCode == Enum.KeyCode.F8 then
  389.         if ObjectElements.Storage.MainFrame.Instance.Visible then
  390.             ObjectElements.Storage.MainFrame.Instance.Visible = false
  391.         else
  392.             ObjectElements.Storage.MainFrame.Instance.Visible = true
  393.         end
  394.     end
  395. end)
  396.  
  397. -- Ending Stuff
  398. JCFs.RefreshColors()
  399. print('Django - Loaded successfully!')
  400.  
Advertisement
Add Comment
Please, Sign In to add comment