Advertisement
CAT_SUS

Combo.lua

Jul 13th, 2023 (edited)
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.22 KB | None | 0 0
  1. --[[
  2.     (Blox Fruit or other game) Auto Combo Free Source Code
  3.     by bedol hub
  4.     [BETA SCRIPT]
  5. ]]
  6.  
  7. local vsKeys =  {
  8.     [Enum.KeyCode.Unknown] = 0x00,
  9.     [Enum.KeyCode.Backspace] = 0x08,
  10.     [Enum.KeyCode.Tab] = 0x09,
  11.     [Enum.KeyCode.Clear] = 0x0C,
  12.     [Enum.KeyCode.Return] = 0x0D,
  13.     [Enum.KeyCode.Pause] = 0x13,
  14.     [Enum.KeyCode.Escape] = 0x1B,
  15.     [Enum.KeyCode.Space] = 0x20,
  16.     [Enum.KeyCode.Quote] = 0xDE,
  17.     [Enum.KeyCode.Comma] = 0xBC,
  18.     [Enum.KeyCode.Minus] = 0xBD,
  19.     [Enum.KeyCode.Period] = 0xBE,
  20.     [Enum.KeyCode.Slash] = 0xBF,
  21.     [Enum.KeyCode.Zero] = 0x30,
  22.     [Enum.KeyCode.One] = 0x31,
  23.     [Enum.KeyCode.Two] = 0x32,
  24.     [Enum.KeyCode.Three] = 0x33,
  25.     [Enum.KeyCode.Four] = 0x34,
  26.     [Enum.KeyCode.Five] = 0x35,
  27.     [Enum.KeyCode.Six] = 0x36,
  28.     [Enum.KeyCode.Seven] = 0x37,
  29.     [Enum.KeyCode.Eight] = 0x38,
  30.     [Enum.KeyCode.Nine] = 0x39,
  31.     [Enum.KeyCode.Semicolon] = 0xBA,
  32.     [Enum.KeyCode.Equals] = 0xBB,
  33.     [Enum.KeyCode.A] = 0x41,
  34.     [Enum.KeyCode.B] = 0x42,
  35.     [Enum.KeyCode.C] = 0x43,
  36.     [Enum.KeyCode.D] = 0x44,
  37.     [Enum.KeyCode.E] = 0x45,
  38.     [Enum.KeyCode.F] = 0x46,
  39.     [Enum.KeyCode.G] = 0x47,
  40.     [Enum.KeyCode.H] = 0x48,
  41.     [Enum.KeyCode.I] = 0x49,
  42.     [Enum.KeyCode.J] = 0x4A,
  43.     [Enum.KeyCode.K] = 0x4B,
  44.     [Enum.KeyCode.L] = 0x4C,
  45.     [Enum.KeyCode.M] = 0x4D,
  46.     [Enum.KeyCode.N] = 0x4E,
  47.     [Enum.KeyCode.O] = 0x4F,
  48.     [Enum.KeyCode.P] = 0x50,
  49.     [Enum.KeyCode.Q] = 0x51,
  50.     [Enum.KeyCode.R] = 0x52,
  51.     [Enum.KeyCode.S] = 0x53,
  52.     [Enum.KeyCode.T] = 0x54,
  53.     [Enum.KeyCode.U] = 0x55,
  54.     [Enum.KeyCode.V] = 0x56,
  55.     [Enum.KeyCode.W] = 0x57,
  56.     [Enum.KeyCode.X] = 0x58,
  57.     [Enum.KeyCode.Y] = 0x59,
  58.     [Enum.KeyCode.Z] = 0x5A,
  59. }
  60.  
  61. local AutoCombo = Instance.new("ScreenGui")
  62. local main = Instance.new("Frame")
  63. local Title = Instance.new("TextLabel")
  64. local ScrollingFrame = Instance.new("ScrollingFrame")
  65. local UIListLayout = Instance.new("UIListLayout")
  66. local Frame = Instance.new("Frame")
  67. local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
  68. local Title_2 = Instance.new("TextLabel")
  69. local CreateButton = Instance.new("TextButton")
  70. local UIStroke = Instance.new("UIStroke")
  71.  
  72. AutoCombo.Name = "AutoCombo"
  73. AutoCombo.Parent = game:FindFirstChild('CoreGui') or game.Players.LocalPlayer:WaitForChild("PlayerGui")
  74. AutoCombo.ResetOnSpawn = false
  75. AutoCombo.IgnoreGuiInset = true
  76. AutoCombo.ZIndexBehavior = Enum.ZIndexBehavior.Global
  77.  
  78. main.Name = "main"
  79. main.Parent = AutoCombo
  80. main.BackgroundColor3 = Color3.fromRGB(25, 25, 25)
  81. main.BorderColor3 = Color3.fromRGB(0, 0, 0)
  82. main.BorderSizePixel = 0
  83. main.Position = UDim2.new(0.0255310461, 0, 0.324388593, 0)
  84. main.Size = UDim2.new(0.349999994, 0, 0.4, 0)
  85.  
  86. Title.Name = "Title"
  87. Title.Parent = main
  88. Title.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  89. Title.BackgroundTransparency = 1.000
  90. Title.BorderColor3 = Color3.fromRGB(0, 0, 0)
  91. Title.BorderSizePixel = 0
  92. Title.Position = UDim2.new(0.0233426709, 0, 0, 0)
  93. Title.Size = UDim2.new(0.899999976, 0, 0.100000001, 0)
  94. Title.Font = Enum.Font.Unknown
  95. Title.RichText = true
  96. Title.Text = "Bedol <font color=\"rgb(255, 0, 4)\">Hub</font> | <font color=\"rgb(255, 217, 0)\">Auto Combo</font>"
  97. Title.TextColor3 = Color3.fromRGB(255, 255, 255)
  98. Title.TextScaled = true
  99. Title.TextSize = 14.000
  100. Title.TextWrapped = true
  101. Title.TextXAlignment = Enum.TextXAlignment.Left
  102.  
  103. ScrollingFrame.Parent = main
  104. ScrollingFrame.Active = true
  105. ScrollingFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  106. ScrollingFrame.BackgroundTransparency = 1.000
  107. ScrollingFrame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  108. ScrollingFrame.BorderSizePixel = 0
  109. ScrollingFrame.Position = UDim2.new(0.0175070036, 0, 0.160131991, 0)
  110. ScrollingFrame.Size = UDim2.new(0.959999979, 0, 0.800000012, 0)
  111. ScrollingFrame.BottomImage = ""
  112. ScrollingFrame.ScrollBarThickness = 4
  113. ScrollingFrame.TopImage = ""
  114.  
  115. UIListLayout.Parent = ScrollingFrame
  116. UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
  117. UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  118. UIListLayout.Padding = UDim.new(0, 5)
  119.  
  120. Frame.Parent = ScrollingFrame
  121. Frame.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
  122. Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  123. Frame.BorderSizePixel = 0
  124. Frame.Size = UDim2.new(0.980000019, 0, 0.5, 0)
  125.  
  126. UIAspectRatioConstraint.Parent = Frame
  127. UIAspectRatioConstraint.AspectRatio = 8.000
  128. UIAspectRatioConstraint.AspectType = Enum.AspectType.ScaleWithParentSize
  129.  
  130. Title_2.Name = "Title"
  131. Title_2.Parent = Frame
  132. Title_2.BackgroundColor3 = Color3.fromRGB(12, 12, 12)
  133. Title_2.BackgroundTransparency = 0.550
  134. Title_2.BorderColor3 = Color3.fromRGB(0, 0, 0)
  135. Title_2.BorderSizePixel = 0
  136. Title_2.Position = UDim2.new(0.027912952, 0, 0.248115122, 0)
  137. Title_2.Size = UDim2.new(0.800000012, 0, 0.5, 0)
  138. Title_2.Font = Enum.Font.Unknown
  139. Title_2.Text = "Add Data"
  140. Title_2.TextColor3 = Color3.fromRGB(255, 255, 255)
  141. Title_2.TextScaled = true
  142. Title_2.TextSize = 14.000
  143. Title_2.TextWrapped = true
  144. Title_2.TextXAlignment = Enum.TextXAlignment.Left
  145.  
  146. CreateButton.Name = "CreateButton"
  147. CreateButton.Parent = Frame
  148. CreateButton.AnchorPoint = Vector2.new(0, 0.5)
  149. CreateButton.BackgroundColor3 = Color3.fromRGB(94, 94, 94)
  150. CreateButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
  151. CreateButton.BorderSizePixel = 0
  152. CreateButton.Position = UDim2.new(0.875, 0, 0.5, 0)
  153. CreateButton.Size = UDim2.new(0.600000024, 0, 0.600000024, 0)
  154. CreateButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
  155. CreateButton.Font = Enum.Font.Unknown
  156. CreateButton.Text = "Add"
  157. CreateButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  158. CreateButton.TextScaled = true
  159. CreateButton.TextSize = 14.000
  160. CreateButton.TextWrapped = true
  161.  
  162. UIStroke.Thickness = 2.200
  163. UIStroke.Transparency = 0.800
  164. UIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  165. UIStroke.Parent = CreateButton
  166.  
  167. local function SrtToKeyode(Str)
  168.     for _, keyCodeEnum in pairs(Enum.KeyCode:GetEnumItems()) do
  169.         local MYITEM = Str:lower()
  170.         local target = keyCodeEnum.Name:lower()
  171.         if target == MYITEM then
  172.             return keyCodeEnum
  173.         end
  174.     end
  175.     return nil
  176. end
  177.  
  178. local function presskey(keycode)
  179.     local target = vsKeys[keycode]
  180.     if target then
  181.         print(target)
  182.         pcall(function()
  183.             keypress(target)
  184.             wait()
  185.             keyrelease(target)
  186.         end)
  187.     end
  188. end
  189.  
  190. local function AddSetting(data : {namefile:string,ttkey : Enum.KeyCode,ofbs : {timed:number,target:Enum.KeyCode,namek:string}})
  191.     data = data or {}
  192.     local KeyDatas = {
  193.         Start = nil,
  194.         Codes = {},
  195.     }
  196.     local MY_KEY = data['ttkey'] or nil
  197.     _G.FGH = _G.FGH or 1
  198.    
  199.     _G.FGH += 1
  200.    
  201.     local Main = Instance.new("Frame")
  202.     local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
  203.     local FileName = Instance.new("TextBox")
  204.     local ScrollingFramea = Instance.new("ScrollingFrame",Main)
  205.     local UIListLayout = Instance.new("UIListLayout")
  206.     local CreateKeyButton = Instance.new("TextButton")
  207.     local UIStroke = Instance.new("UIStroke")
  208.  
  209.     Main.Name = "Main"
  210.     Main.Parent = ScrollingFrame
  211.     Main.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
  212.     Main.BorderColor3 = Color3.fromRGB(0, 0, 0)
  213.     Main.BorderSizePixel = 0
  214.     Main.Size = UDim2.new(0.930000007, 0, 0.5, 0)
  215.  
  216.     UIAspectRatioConstraint.Parent = Main
  217.     UIAspectRatioConstraint.AspectRatio = 2.200
  218.     UIAspectRatioConstraint.AspectType = Enum.AspectType.ScaleWithParentSize
  219.  
  220.     FileName.Name = "FileName"
  221.     FileName.Parent = Main
  222.     FileName.BackgroundColor3 = Color3.fromRGB(22, 22, 22)
  223.     FileName.BackgroundTransparency = 0.200
  224.     FileName.BorderColor3 = Color3.fromRGB(0, 0, 0)
  225.     FileName.BorderSizePixel = 0
  226.     FileName.Position = UDim2.new(0.043086648, 0, 0.0618821234, 0)
  227.     FileName.Size = UDim2.new(0.600000024, 0, 0.218929917, 0)
  228.     FileName.ClearTextOnFocus = false
  229.     FileName.Font = Enum.Font.Sarpanch
  230.     FileName.PlaceholderText = "File_Name"
  231.     FileName.Text = data['namefile'] or "Untitled "..tostring(_G.FGH)
  232.     FileName.TextColor3 = Color3.fromRGB(255, 255, 255)
  233.     FileName.TextScaled = true
  234.     FileName.TextSize = 14.000
  235.     FileName.TextWrapped = true
  236.     FileName.TextXAlignment = Enum.TextXAlignment.Left
  237.  
  238.     ScrollingFramea.Active = true
  239.     ScrollingFramea.BackgroundColor3 = Color3.fromRGB(33, 33, 33)
  240.     ScrollingFramea.BackgroundTransparency = 0.550
  241.     ScrollingFramea.BorderColor3 = Color3.fromRGB(0, 0, 0)
  242.     ScrollingFramea.BorderSizePixel = 0
  243.     ScrollingFramea.Position = UDim2.new(0.0424864292, 0, 0.366690159, 0)
  244.     ScrollingFramea.Size = UDim2.new(0.931707144, 0, 0.602867782, 0)
  245.     ScrollingFramea.ScrollBarThickness = 2
  246.  
  247.     UIListLayout.Parent = ScrollingFramea
  248.     UIListLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
  249.     UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
  250.     UIListLayout.Padding = UDim.new(0, 5)
  251.  
  252.     CreateKeyButton.Name = "CreateKeyButton"
  253.     CreateKeyButton.Parent = Main
  254.     CreateKeyButton.AnchorPoint = Vector2.new(0, 0.5)
  255.     CreateKeyButton.BackgroundColor3 = Color3.fromRGB(94, 94, 94)
  256.     CreateKeyButton.BorderColor3 = Color3.fromRGB(0, 0, 0)
  257.     CreateKeyButton.BorderSizePixel = 0
  258.     CreateKeyButton.Position = UDim2.new(0.819440842, 0, 0.183639854, 0)
  259.     CreateKeyButton.Size = UDim2.new(0.25, 0, 0.25, 0)
  260.     CreateKeyButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
  261.     CreateKeyButton.Font = Enum.Font.Unknown
  262.     CreateKeyButton.Text = "Create Key"
  263.     CreateKeyButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  264.     CreateKeyButton.TextScaled = true
  265.     CreateKeyButton.TextSize = 14.000
  266.     CreateKeyButton.TextWrapped = true
  267.  
  268.     UIStroke.Thickness = 2.200
  269.     UIStroke.Transparency = 0.800
  270.     UIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  271.     UIStroke.Parent = CreateKeyButton
  272.    
  273.     local KeyToRun = Instance.new("TextBox")
  274.  
  275.     KeyToRun.Name = "Key To Run"
  276.     KeyToRun.Parent = Main
  277.     KeyToRun.BackgroundColor3 = Color3.fromRGB(22, 22, 22)
  278.     KeyToRun.BackgroundTransparency = 0.200
  279.     KeyToRun.BorderColor3 = Color3.fromRGB(0, 0, 0)
  280.     KeyToRun.BorderSizePixel = 0
  281.     KeyToRun.Position = UDim2.new(0.673846066, 0, 0.0618821234, 0)
  282.     KeyToRun.Size = UDim2.new(0.116308942, 0, 0.218929917, 0)
  283.     KeyToRun.ClearTextOnFocus = false
  284.     KeyToRun.Font = Enum.Font.Sarpanch
  285.     KeyToRun.PlaceholderText = "Key To Run"
  286.     KeyToRun.Text = ""
  287.     KeyToRun.TextColor3 = Color3.fromRGB(255, 255, 255)
  288.     KeyToRun.TextScaled = true
  289.     KeyToRun.TextSize = 14.000
  290.     KeyToRun.TextWrapped = true
  291.     KeyToRun.TextXAlignment = Enum.TextXAlignment.Left
  292.    
  293.     KeyToRun.FocusLost:Connect(function()
  294.         local key = SrtToKeyode(KeyToRun.Text)
  295.         if key then
  296.             KeyToRun.Text = key.Name
  297.             KeyDatas.Start = key
  298.         else
  299.             KeyToRun.Text = ""
  300.         end
  301.     end)
  302.    
  303.     local function MakeKK(dataconfix : {timed:number,key:Enum.KeyCode})
  304.         dataconfix = dataconfix or  {}
  305.        
  306.         local Key = Instance.new("Frame")
  307.         local UIAspectRatioConstraint = Instance.new("UIAspectRatioConstraint")
  308.         local KeyCode = Instance.new("TextBox")
  309.         local KeyTime = Instance.new("TextBox")
  310.         local Del = Instance.new("TextButton")
  311.         local UIStroke = Instance.new("UIStroke")
  312.        
  313.         table.insert(KeyDatas.Codes,{
  314.             KEY = nil,
  315.             TIMED = 0,
  316.             DATE = Key
  317.         })
  318.        
  319.         local index = #KeyDatas.Codes
  320.        
  321.         local function UP_INDEX()
  322.             for i,v in ipairs(KeyDatas.Codes) do
  323.                 if v.DATE == Key then
  324.                     index = i
  325.                     return i
  326.                 end
  327.             end
  328.         end
  329.  
  330.         Key.Name = "Key"
  331.         Key.Parent = ScrollingFramea
  332.         Key.BackgroundColor3 = Color3.fromRGB(24, 24, 24)
  333.         Key.BorderColor3 = Color3.fromRGB(0, 0, 0)
  334.         Key.BorderSizePixel = 0
  335.         Key.Size = UDim2.new(0.980000019, 0, 0.5, 0)
  336.  
  337.         UIAspectRatioConstraint.Parent = Key
  338.         UIAspectRatioConstraint.AspectRatio = 7.000
  339.         UIAspectRatioConstraint.AspectType = Enum.AspectType.ScaleWithParentSize
  340.  
  341.         KeyCode.Name = "KeyCode"
  342.         KeyCode.Parent = Key
  343.         KeyCode.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  344.         KeyCode.BackgroundTransparency = 0.800
  345.         KeyCode.BorderColor3 = Color3.fromRGB(0, 0, 0)
  346.         KeyCode.BorderSizePixel = 0
  347.         KeyCode.Position = UDim2.new(0.0393725522, 0, 0.125276297, 0)
  348.         KeyCode.Size = UDim2.new(0.300000012, 0, 0.699999988, 0)
  349.         KeyCode.ClearTextOnFocus = false
  350.         KeyCode.Font = Enum.Font.Unknown
  351.         KeyCode.PlaceholderText = "Key"
  352.         KeyCode.Text = (dataconfix['key'] and dataconfix['key']['Name']) or ""
  353.         KeyCode.TextColor3 = Color3.fromRGB(255, 255, 255)
  354.         KeyCode.TextScaled = true
  355.         KeyCode.TextSize = 14.000
  356.         KeyCode.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  357.         KeyCode.TextWrapped = true
  358.  
  359.         KeyTime.Name = "KeyTime"
  360.         KeyTime.Parent = Key
  361.         KeyTime.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  362.         KeyTime.BackgroundTransparency = 0.800
  363.         KeyTime.BorderColor3 = Color3.fromRGB(0, 0, 0)
  364.         KeyTime.BorderSizePixel = 0
  365.         KeyTime.Position = UDim2.new(0.433098078, 0, 0.125276297, 0)
  366.         KeyTime.Size = UDim2.new(0.300000012, 0, 0.699999988, 0)
  367.         KeyTime.ClearTextOnFocus = false
  368.         KeyTime.Font = Enum.Font.Unknown
  369.         KeyTime.PlaceholderText = "Time"
  370.         KeyTime.Text = dataconfix['timed'] or ""
  371.         KeyTime.TextColor3 = Color3.fromRGB(255, 255, 255)
  372.         KeyTime.TextScaled = true
  373.         KeyTime.TextSize = 14.000
  374.         KeyTime.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  375.         KeyTime.TextWrapped = true
  376.  
  377.         Del.Name = "Del"
  378.         Del.Parent = Key
  379.         Del.AnchorPoint = Vector2.new(0, 0.5)
  380.         Del.BackgroundColor3 = Color3.fromRGB(94, 94, 94)
  381.         Del.BackgroundTransparency = 0.400
  382.         Del.BorderColor3 = Color3.fromRGB(0, 0, 0)
  383.         Del.BorderSizePixel = 0
  384.         Del.Position = UDim2.new(0.837337434, 0, 0.484302998, 0)
  385.         Del.Size = UDim2.new(0.850000024, 0, 0.850000024, 0)
  386.         Del.SizeConstraint = Enum.SizeConstraint.RelativeYY
  387.         Del.Font = Enum.Font.Unknown
  388.         Del.Text = "Delete"
  389.         Del.TextColor3 = Color3.fromRGB(255, 255, 255)
  390.         Del.TextScaled = true
  391.         Del.TextSize = 14.000
  392.         Del.TextWrapped = true
  393.  
  394.         UIStroke.Thickness = 2.200
  395.         UIStroke.Transparency = 0.800
  396.         UIStroke.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  397.         UIStroke.Parent = Del
  398.        
  399.         local time_show = Instance.new("TextLabel")
  400.  
  401.         time_show.Name = "time_show"
  402.         time_show.Parent = Key
  403.         time_show.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  404.         time_show.BackgroundTransparency = 1.000
  405.         time_show.BorderColor3 = Color3.fromRGB(0, 0, 0)
  406.         time_show.BorderSizePixel = 0
  407.         time_show.Size = UDim2.new(0.100000001, 0, 0.100000001, 0)
  408.         time_show.Font = Enum.Font.SourceSans
  409.         time_show.Text = tostring(index)
  410.         time_show.TextColor3 = Color3.fromRGB(255, 255, 255)
  411.         time_show.TextScaled = true
  412.         time_show.TextSize = 14.000
  413.         time_show.TextWrapped = true
  414.        
  415.         KeyTime.Changed:Connect(function()
  416.             UP_INDEX()
  417.             time_show.Text = tostring(index)
  418.             local data = tonumber(KeyTime.Text)
  419.             if not data then
  420.                 KeyTime.Text = ""
  421.             else
  422.                 local me = KeyDatas.Codes[index]
  423.                 if me then
  424.                     me.TIMED = data
  425.                 end
  426.             end
  427.         end)
  428.         Main.Changed:Connect(function()
  429.             UP_INDEX()
  430.             time_show.Text = tostring(index)
  431.         end)
  432.         KeyCode.FocusLost:Connect(function()
  433.             time_show.Text = tostring(index)
  434.             UP_INDEX()
  435.             local key : Enum.KeyCode = SrtToKeyode(KeyCode.Text)
  436.             if key then
  437.                 KeyCode.Text = key.Name
  438.                 local me = KeyDatas.Codes[index]
  439.                 if me then
  440.                     me.KEY = key
  441.                 end
  442.             else
  443.                 KeyCode.Text = ""
  444.             end
  445.         end)
  446.        
  447.         Del.MouseButton1Click:Connect(function()
  448.            
  449.             table.remove(KeyDatas.Codes,index)
  450.             Key:Destroy()
  451.         end)
  452.     end
  453.    
  454.     local function Run()
  455.         for i,v in ipairs(KeyDatas.Codes) do
  456.             presskey(v.KEY)
  457.             wait(v.TIMED)
  458.         end
  459.     end
  460.    
  461.     CreateKeyButton.MouseButton1Click:Connect(function()
  462.         MakeKK()
  463.     end)
  464.    
  465.     game:GetService('UserInputService').InputBegan:Connect(function(KeyCode)
  466.         if KeyCode.KeyCode == KeyDatas.Start then
  467.             Run()
  468.         end
  469.     end)
  470. end
  471.  
  472. CreateButton.MouseButton1Click:Connect(function()
  473.     AddSetting()
  474. end)
  475.  
  476. local UIS = game:GetService('UserInputService')
  477. local dragToggle = nil
  478. local dragSpeed = 0.1
  479. local dragStart = nil
  480. local startPos = nil
  481.  
  482. local function updateInput(input)
  483.     local delta = input.Position - dragStart
  484.     local position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X,
  485.         startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  486.     game:GetService('TweenService'):Create(main, TweenInfo.new(dragSpeed), {Position = position}):Play()
  487. end
  488.  
  489. main.InputBegan:Connect(function(input)
  490.     if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
  491.         dragToggle = true
  492.         dragStart = input.Position
  493.         startPos = main.Position
  494.         input.Changed:Connect(function()
  495.             if input.UserInputState == Enum.UserInputState.End then
  496.                 dragToggle = false
  497.             end
  498.         end)
  499.     end
  500. end)
  501.  
  502. UIS.InputChanged:Connect(function(input)
  503.     if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  504.         if dragToggle then
  505.             updateInput(input)
  506.         end
  507.     end
  508. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement