Advertisement
ERROR_CODE

Calc

Dec 7th, 2023 (edited)
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.80 KB | None | 0 0
  1. local ScreenGui = Instance.new("ScreenGui")
  2. local CalcFrame = Instance.new("Frame")
  3. local UICorner = Instance.new("UICorner")
  4. local ButtonsFrame = Instance.new("Frame")
  5. local UICorner_2 = Instance.new("UICorner")
  6. local UIGridLayout = Instance.new("UIGridLayout")
  7. local _1 = Instance.new("TextButton")
  8. local UICorner_3 = Instance.new("UICorner")
  9. local UIPadding = Instance.new("UIPadding")
  10. local _2 = Instance.new("TextButton")
  11. local UICorner_4 = Instance.new("UICorner")
  12. local _3 = Instance.new("TextButton")
  13. local UICorner_5 = Instance.new("UICorner")
  14. local TextButton = Instance.new("TextButton")
  15. local UICorner_6 = Instance.new("UICorner")
  16. local _4 = Instance.new("TextButton")
  17. local UICorner_7 = Instance.new("UICorner")
  18. local _5 = Instance.new("TextButton")
  19. local UICorner_8 = Instance.new("UICorner")
  20. local _6 = Instance.new("TextButton")
  21. local UICorner_9 = Instance.new("UICorner")
  22. local TextButton_2 = Instance.new("TextButton")
  23. local UICorner_10 = Instance.new("UICorner")
  24. local _7 = Instance.new("TextButton")
  25. local UICorner_11 = Instance.new("UICorner")
  26. local _8 = Instance.new("TextButton")
  27. local UICorner_12 = Instance.new("UICorner")
  28. local _9 = Instance.new("TextButton")
  29. local UICorner_13 = Instance.new("UICorner")
  30. local TextButton_3 = Instance.new("TextButton")
  31. local UICorner_14 = Instance.new("UICorner")
  32. local _0 = Instance.new("TextButton")
  33. local UICorner_15 = Instance.new("UICorner")
  34. local TextButton_4 = Instance.new("TextButton")
  35. local UICorner_16 = Instance.new("UICorner")
  36. local TextButton_5 = Instance.new("TextButton")
  37. local UICorner_17 = Instance.new("UICorner")
  38. local TextButton_6 = Instance.new("TextButton")
  39. local UICorner_18 = Instance.new("UICorner")
  40. local C = Instance.new("TextButton")
  41. local UICorner_19 = Instance.new("UICorner")
  42. local TextButton_7 = Instance.new("TextButton")
  43. local UICorner_20 = Instance.new("UICorner")
  44. local TextButton_8 = Instance.new("TextButton")
  45. local UICorner_21 = Instance.new("UICorner")
  46. local TextButton_9 = Instance.new("TextButton")
  47. local UICorner_22 = Instance.new("UICorner")
  48. local UIPadding_2 = Instance.new("UIPadding")
  49. local NumFrame = Instance.new("Frame")
  50. local UIPadding_3 = Instance.new("UIPadding")
  51. local UICorner_23 = Instance.new("UICorner")
  52. local Text = Instance.new("TextLabel")
  53. local CloseCalcButton = Instance.new("TextButton")
  54. local CloseCalcButtonUICorner = Instance.new("UICorner")
  55.  
  56. ScreenGui.Parent = game:GetService("CoreGui")
  57.  
  58. CloseCalcButton.Name = "CloseCalcButton"
  59. CloseCalcButton.Position = UDim2.new(0.9, 0, 0, 0)
  60. CloseCalcButton.Parent = CalcFrame
  61. CloseCalcButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  62. CloseCalcButton.BackgroundTransparency = 0.5
  63. CloseCalcButton.LayoutOrder = 1
  64. CloseCalcButton.Size = UDim2.new(0, 20, 0, 20)
  65. CloseCalcButton.AutoButtonColor = false
  66. CloseCalcButton.Font = Enum.Font.Code
  67. CloseCalcButton.Text = "X"
  68. CloseCalcButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  69. CloseCalcButton.TextScaled = true
  70. CloseCalcButton.TextSize = 14.000
  71. CloseCalcButton.TextWrapped = true
  72.  
  73. CloseCalcButtonUICorner.Parent = CloseCalcButton
  74.  
  75. CloseCalcButton.MouseButton1Click:Connect(function()
  76. CalcFrame.Visible = false
  77. end)
  78.  
  79. CalcFrame.Name = "CalcFrame"
  80. CalcFrame.Parent = ScreenGui
  81. CalcFrame.AnchorPoint = Vector2.new(0.5, 0.5)
  82. CalcFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  83. CalcFrame.BackgroundTransparency = 0.5
  84. CalcFrame.Position = UDim2.new(0.5, 0, 0.5, 0)
  85. CalcFrame.Size = UDim2.new(0, 240, 0, 255)
  86.  
  87. UICorner.Parent = CalcFrame
  88.  
  89. ButtonsFrame.Name = "ButtonsFrame"
  90. ButtonsFrame.Parent = CalcFrame
  91. ButtonsFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  92. ButtonsFrame.Position = UDim2.new(0, 0, 0.55, 0)
  93. ButtonsFrame.BackgroundTransparency = 0.5
  94. ButtonsFrame.Size = UDim2.new(0, 220, 0, 100)
  95.  
  96. UICorner_2.Parent = ButtonsFrame
  97.  
  98. UIGridLayout.Parent = ButtonsFrame
  99. UIGridLayout.HorizontalAlignment = Enum.HorizontalAlignment.Center
  100. UIGridLayout.SortOrder = Enum.SortOrder.LayoutOrder
  101. UIGridLayout.VerticalAlignment = Enum.VerticalAlignment.Center
  102. UIGridLayout.CellSize = UDim2.new(0, 20, 0, 20)
  103.  
  104. _1.Name = "1"
  105. _1.Parent = ButtonsFrame
  106. _1.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  107. _1.BackgroundTransparency = 0.5
  108. _1.LayoutOrder = 1
  109. _1.Size = UDim2.new(0, 200, 0, 50)
  110. _1.AutoButtonColor = false
  111. _1.Font = Enum.Font.Code
  112. _1.Text = "1"
  113. _1.TextColor3 = Color3.fromRGB(255, 255, 255)
  114. _1.TextScaled = true
  115. _1.TextSize = 14.000
  116. _1.TextWrapped = true
  117.  
  118. UICorner_3.Parent = _1
  119.  
  120. UIPadding.Parent = ButtonsFrame
  121. UIPadding.PaddingBottom = UDim.new(0, 5)
  122. UIPadding.PaddingLeft = UDim.new(0, 7)
  123. UIPadding.PaddingRight = UDim.new(0, 7)
  124. UIPadding.PaddingTop = UDim.new(0, 5)
  125.  
  126. _2.Name = "2"
  127. _2.Parent = ButtonsFrame
  128. _2.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  129. _2.BackgroundTransparency = 0.5
  130. _2.LayoutOrder = 2
  131. _2.Size = UDim2.new(0, 200, 0, 50)
  132. _2.AutoButtonColor = false
  133. _2.Font = Enum.Font.Code
  134. _2.Text = "2"
  135. _2.TextColor3 = Color3.fromRGB(255, 255, 255)
  136. _2.TextScaled = true
  137. _2.TextSize = 14.000
  138. _2.TextWrapped = true
  139.  
  140. UICorner_4.Parent = _2
  141.  
  142. _3.Name = "3"
  143. _3.Parent = ButtonsFrame
  144. _3.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  145. _3.BackgroundTransparency = 0.5
  146. _3.LayoutOrder = 3
  147. _3.Size = UDim2.new(0, 200, 0, 50)
  148. _3.AutoButtonColor = false
  149. _3.Font = Enum.Font.Code
  150. _3.Text = "3"
  151. _3.TextColor3 = Color3.fromRGB(255, 255, 255)
  152. _3.TextScaled = true
  153. _3.TextSize = 14.000
  154. _3.TextWrapped = true
  155.  
  156. UICorner_5.Parent = _3
  157.  
  158. TextButton.Name = "+"
  159. TextButton.Parent = ButtonsFrame
  160. TextButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  161. TextButton.BackgroundTransparency = 0.5
  162. TextButton.LayoutOrder = 4
  163. TextButton.Size = UDim2.new(0, 200, 0, 50)
  164. TextButton.AutoButtonColor = false
  165. TextButton.Font = Enum.Font.Code
  166. TextButton.Text = "+"
  167. TextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  168. TextButton.TextScaled = true
  169. TextButton.TextSize = 14.000
  170. TextButton.TextWrapped = true
  171.  
  172. UICorner_6.Parent = TextButton
  173.  
  174. _4.Name = "4"
  175. _4.Parent = ButtonsFrame
  176. _4.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  177. _4.BackgroundTransparency = 0.5
  178. _4.LayoutOrder = 5
  179. _4.Size = UDim2.new(0, 200, 0, 50)
  180. _4.AutoButtonColor = false
  181. _4.Font = Enum.Font.Code
  182. _4.Text = "4"
  183. _4.TextColor3 = Color3.fromRGB(255, 255, 255)
  184. _4.TextScaled = true
  185. _4.TextSize = 14.000
  186. _4.TextWrapped = true
  187.  
  188. UICorner_7.Parent = _4
  189.  
  190. _5.Name = "5"
  191. _5.Parent = ButtonsFrame
  192. _5.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  193. _5.BackgroundTransparency = 0.5
  194. _5.LayoutOrder = 6
  195. _5.Size = UDim2.new(0, 200, 0, 50)
  196. _5.AutoButtonColor = false
  197. _5.Font = Enum.Font.Code
  198. _5.Text = "5"
  199. _5.TextColor3 = Color3.fromRGB(255, 255, 255)
  200. _5.TextScaled = true
  201. _5.TextSize = 14.000
  202. _5.TextWrapped = true
  203.  
  204. UICorner_8.Parent = _5
  205.  
  206. _6.Name = "6"
  207. _6.Parent = ButtonsFrame
  208. _6.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  209. _6.BackgroundTransparency = 0.5
  210. _6.LayoutOrder = 7
  211. _6.Size = UDim2.new(0, 200, 0, 50)
  212. _6.AutoButtonColor = false
  213. _6.Font = Enum.Font.Code
  214. _6.Text = "6"
  215. _6.TextColor3 = Color3.fromRGB(255, 255, 255)
  216. _6.TextScaled = true
  217. _6.TextSize = 14.000
  218. _6.TextWrapped = true
  219.  
  220. UICorner_9.Parent = _6
  221.  
  222. TextButton_2.Name = "-"
  223. TextButton_2.Parent = ButtonsFrame
  224. TextButton_2.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  225. TextButton_2.BackgroundTransparency = 0.5
  226. TextButton_2.LayoutOrder = 8
  227. TextButton_2.Size = UDim2.new(0, 200, 0, 50)
  228. TextButton_2.AutoButtonColor = false
  229. TextButton_2.Font = Enum.Font.Code
  230. TextButton_2.Text = "-"
  231. TextButton_2.TextColor3 = Color3.fromRGB(255, 255, 255)
  232. TextButton_2.TextScaled = true
  233. TextButton_2.TextSize = 14.000
  234. TextButton_2.TextWrapped = true
  235.  
  236. UICorner_10.Parent = TextButton_2
  237.  
  238. _7.Name = "7"
  239. _7.Parent = ButtonsFrame
  240. _7.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  241. _7.BackgroundTransparency = 0.5
  242. _7.LayoutOrder = 9
  243. _7.Size = UDim2.new(0, 200, 0, 50)
  244. _7.AutoButtonColor = false
  245. _7.Font = Enum.Font.Code
  246. _7.Text = "7"
  247. _7.TextColor3 = Color3.fromRGB(255, 255, 255)
  248. _7.TextScaled = true
  249. _7.TextSize = 14.000
  250. _7.TextWrapped = true
  251.  
  252. UICorner_11.Parent = _7
  253.  
  254. _8.Name = "8"
  255. _8.Parent = ButtonsFrame
  256. _8.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  257. _8.BackgroundTransparency = 0.5
  258. _8.LayoutOrder = 10
  259. _8.Size = UDim2.new(0, 200, 0, 50)
  260. _8.AutoButtonColor = false
  261. _8.Font = Enum.Font.Code
  262. _8.Text = "8"
  263. _8.TextColor3 = Color3.fromRGB(255, 255, 255)
  264. _8.TextScaled = true
  265. _8.TextSize = 14.000
  266. _8.TextWrapped = true
  267.  
  268. UICorner_12.Parent = _8
  269.  
  270. _9.Name = "9"
  271. _9.Parent = ButtonsFrame
  272. _9.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  273. _9.BackgroundTransparency = 0.5
  274. _9.LayoutOrder = 11
  275. _9.Size = UDim2.new(0, 200, 0, 50)
  276. _9.AutoButtonColor = false
  277. _9.Font = Enum.Font.Code
  278. _9.Text = "9"
  279. _9.TextColor3 = Color3.fromRGB(255, 255, 255)
  280. _9.TextScaled = true
  281. _9.TextSize = 14.000
  282. _9.TextWrapped = true
  283.  
  284. UICorner_13.Parent = _9
  285.  
  286. TextButton_3.Name = "/"
  287. TextButton_3.Parent = ButtonsFrame
  288. TextButton_3.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  289. TextButton_3.BackgroundTransparency = 0.5
  290. TextButton_3.LayoutOrder = 12
  291. TextButton_3.Size = UDim2.new(0, 200, 0, 50)
  292. TextButton_3.AutoButtonColor = false
  293. TextButton_3.Font = Enum.Font.Code
  294. TextButton_3.Text = "÷"
  295. TextButton_3.TextColor3 = Color3.fromRGB(255, 255, 255)
  296. TextButton_3.TextScaled = true
  297. TextButton_3.TextSize = 14.000
  298. TextButton_3.TextWrapped = true
  299.  
  300. UICorner_14.Parent = TextButton_3
  301.  
  302. _0.Name = "0"
  303. _0.Parent = ButtonsFrame
  304. _0.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  305. _0.BackgroundTransparency = 0.5
  306. _0.LayoutOrder = 14
  307. _0.Size = UDim2.new(0, 200, 0, 50)
  308. _0.AutoButtonColor = false
  309. _0.Font = Enum.Font.Code
  310. _0.Text = "0"
  311. _0.TextColor3 = Color3.fromRGB(255, 255, 255)
  312. _0.TextScaled = true
  313. _0.TextSize = 14.000
  314. _0.TextWrapped = true
  315.  
  316. UICorner_15.Parent = _0
  317.  
  318. TextButton_4.Name = "."
  319. TextButton_4.Parent = ButtonsFrame
  320. TextButton_4.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  321. TextButton_4.BackgroundTransparency = 0.5
  322. TextButton_4.LayoutOrder = 13
  323. TextButton_4.Size = UDim2.new(0, 200, 0, 50)
  324. TextButton_4.AutoButtonColor = false
  325. TextButton_4.Font = Enum.Font.Code
  326. TextButton_4.Text = "."
  327. TextButton_4.TextColor3 = Color3.fromRGB(255, 255, 255)
  328. TextButton_4.TextScaled = true
  329. TextButton_4.TextSize = 14.000
  330. TextButton_4.TextWrapped = true
  331.  
  332. UICorner_16.Parent = TextButton_4
  333.  
  334. TextButton_5.Name = "^"
  335. TextButton_5.Parent = ButtonsFrame
  336. TextButton_5.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  337. TextButton_5.BackgroundTransparency = 0.5
  338. TextButton_5.LayoutOrder = 15
  339. TextButton_5.Size = UDim2.new(0, 200, 0, 50)
  340. TextButton_5.AutoButtonColor = false
  341. TextButton_5.Font = Enum.Font.Code
  342. TextButton_5.Text = "aˣ"
  343. TextButton_5.TextColor3 = Color3.fromRGB(255, 255, 255)
  344. TextButton_5.TextScaled = true
  345. TextButton_5.TextSize = 14.000
  346. TextButton_5.TextWrapped = true
  347.  
  348. UICorner_17.Parent = TextButton_5
  349.  
  350. TextButton_6.Name = "*"
  351. TextButton_6.Parent = ButtonsFrame
  352. TextButton_6.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  353. TextButton_6.BackgroundTransparency = 0.5
  354. TextButton_6.LayoutOrder = 16
  355. TextButton_6.Size = UDim2.new(0, 200, 0, 50)
  356. TextButton_6.AutoButtonColor = false
  357. TextButton_6.Font = Enum.Font.Code
  358. TextButton_6.Text = "×"
  359. TextButton_6.TextColor3 = Color3.fromRGB(255, 255, 255)
  360. TextButton_6.TextScaled = true
  361. TextButton_6.TextSize = 14.000
  362. TextButton_6.TextWrapped = true
  363.  
  364. UICorner_18.Parent = TextButton_6
  365.  
  366. C.Name = "C"
  367. C.Parent = ButtonsFrame
  368. C.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  369. C.BackgroundTransparency = 0.5
  370. C.LayoutOrder = 17
  371. C.Size = UDim2.new(0, 200, 0, 50)
  372. C.AutoButtonColor = false
  373. C.Font = Enum.Font.Code
  374. C.Text = "C"
  375. C.TextColor3 = Color3.fromRGB(255, 255, 255)
  376. C.TextScaled = true
  377. C.TextSize = 14.000
  378. C.TextWrapped = true
  379.  
  380. UICorner_19.Parent = C
  381.  
  382. TextButton_7.Name = "("
  383. TextButton_7.Parent = ButtonsFrame
  384. TextButton_7.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  385. TextButton_7.BackgroundTransparency = 0.5
  386. TextButton_7.LayoutOrder = 18
  387. TextButton_7.Size = UDim2.new(0, 200, 0, 50)
  388. TextButton_7.AutoButtonColor = false
  389. TextButton_7.Font = Enum.Font.Code
  390. TextButton_7.Text = "("
  391. TextButton_7.TextColor3 = Color3.fromRGB(255, 255, 255)
  392. TextButton_7.TextScaled = true
  393. TextButton_7.TextSize = 14.000
  394. TextButton_7.TextWrapped = true
  395.  
  396. UICorner_20.Parent = TextButton_7
  397.  
  398. TextButton_8.Name = ")"
  399. TextButton_8.Parent = ButtonsFrame
  400. TextButton_8.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  401. TextButton_8.BackgroundTransparency = 0.5
  402. TextButton_8.LayoutOrder = 18
  403. TextButton_8.Size = UDim2.new(0, 200, 0, 50)
  404. TextButton_8.AutoButtonColor = false
  405. TextButton_8.Font = Enum.Font.Code
  406. TextButton_8.Text = ")"
  407. TextButton_8.TextColor3 = Color3.fromRGB(255, 255, 255)
  408. TextButton_8.TextScaled = true
  409. TextButton_8.TextSize = 14.000
  410. TextButton_8.TextWrapped = true
  411.  
  412. UICorner_21.Parent = TextButton_8
  413.  
  414. TextButton_9.Name = "="
  415. TextButton_9.Parent = ButtonsFrame
  416. TextButton_9.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  417. TextButton_9.BackgroundTransparency = 0.5
  418. TextButton_9.LayoutOrder = 19
  419. TextButton_9.Size = UDim2.new(0, 200, 0, 50)
  420. TextButton_9.AutoButtonColor = false
  421. TextButton_9.Font = Enum.Font.Code
  422. TextButton_9.Text = "="
  423. TextButton_9.TextColor3 = Color3.fromRGB(255, 255, 255)
  424. TextButton_9.TextScaled = true
  425. TextButton_9.TextSize = 14.000
  426. TextButton_9.TextWrapped = true
  427.  
  428. UICorner_22.Parent = TextButton_9
  429.  
  430. UIPadding_2.Parent = CalcFrame
  431. UIPadding_2.PaddingBottom = UDim.new(0, 10)
  432. UIPadding_2.PaddingLeft = UDim.new(0, 10)
  433. UIPadding_2.PaddingRight = UDim.new(0, 10)
  434. UIPadding_2.PaddingTop = UDim.new(0, 10)
  435.  
  436. NumFrame.Name = "NumFrame"
  437. NumFrame.Parent = CalcFrame
  438. NumFrame.Position = UDim2.new(0, 0, 0.1, 0)
  439. NumFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  440. NumFrame.BackgroundTransparency = 0.5
  441. NumFrame.Size = UDim2.new(0, 220, 0, 85)
  442.  
  443. UIPadding_3.Parent = NumFrame
  444. UIPadding_3.PaddingBottom = UDim.new(0, 5)
  445. UIPadding_3.PaddingLeft = UDim.new(0, 7)
  446. UIPadding_3.PaddingRight = UDim.new(0, 7)
  447. UIPadding_3.PaddingTop = UDim.new(0, 5)
  448.  
  449. UICorner_23.Parent = NumFrame
  450.  
  451. Text.Name = "Text"
  452. Text.Parent = NumFrame
  453. Text.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  454. Text.BackgroundTransparency = 1.000
  455. Text.Size = UDim2.new(0, 215, 0, 80)
  456. Text.Font = Enum.Font.Code
  457. Text.Text = "0"
  458. Text.TextColor3 = Color3.fromRGB(255, 255, 255)
  459. Text.TextScaled = true
  460. Text.TextSize = 50.000
  461. Text.TextWrapped = true
  462. Text.TextXAlignment = Enum.TextXAlignment.Right
  463.  
  464.  
  465.  
  466. local numLabel = ScreenGui.CalcFrame.NumFrame.Text
  467.  
  468. for _, v in pairs(ScreenGui.CalcFrame.ButtonsFrame:GetChildren()) do
  469.     if v:IsA("TextButton") then
  470.         if v.Name == "=" then
  471.             v.MouseButton1Click:Connect(function()
  472.                 local ran, val = pcall(loadstring("local res = (".. numLabel.Text .."); return res"))
  473.                 if ran then
  474.                     numLabel.Text = val
  475.                 else
  476.                     numLabel.Text = "Err"
  477.                 end
  478.             end)
  479.         elseif v.Name == "C" then
  480.             v.MouseButton1Click:Connect(function()
  481.                 numLabel.Text = "0"
  482.             end)
  483.         else
  484.             v.MouseButton1Click:Connect(function()
  485.                 if numLabel.Text == "0" or numLabel.Text == "Err" then
  486.                     numLabel.Text = ""
  487.                 end
  488.                
  489.                 numLabel.Text = numLabel.Text.. v.Name
  490.             end)
  491.         end
  492.     end
  493. end
  494.  
  495. local UserInputService = game:GetService("UserInputService")
  496. local gui = CalcFrame
  497.  
  498. local dragging
  499. local dragInput
  500. local dragStart
  501. local startPos
  502.  
  503. local function update(input)
  504.     local delta = input.Position - dragStart
  505.     gui.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  506. end
  507.  
  508. gui.InputBegan:Connect(function(input)
  509.     if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  510.         dragging = true
  511.         dragStart = input.Position
  512.         startPos = gui.Position
  513.  
  514.         input.Changed:Connect(function()
  515.             if input.UserInputState == Enum.UserInputState.End then
  516.                 dragging = false
  517.             end
  518.         end)
  519.     end
  520. end)
  521.  
  522. gui.InputChanged:Connect(function(input)
  523.     if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  524.         dragInput = input
  525.     end
  526. end)
  527.  
  528. UserInputService.InputChanged:Connect(function(input)
  529.     if input == dragInput and dragging then
  530.         update(input)
  531.     end
  532. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement