MaxproGlitcher

ProximityPrompts so mobile users can tap

Dec 19th, 2025
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 31.98 KB | None | 0 0
  1. f not game:IsLoaded() then game.Loaded:Wait() end
  2.  
  3. local plrs = game:GetService("Players")
  4. local pps = game:GetService("ProximityPromptService")
  5. local uis = game:GetService("UserInputService")
  6. local ts = game:GetService("TweenService")
  7. local hs = game:GetService("HttpService")
  8.  
  9. local lp = plrs.LocalPlayer or plrs.PlayerAdded:Wait()
  10.  
  11. local function getPar()
  12. local ok, g
  13. if typeof(gethui) == "function" then
  14. ok, g = pcall(gethui)
  15. if ok and typeof(g) == "Instance" then
  16. return g
  17. end
  18. end
  19. local cg = game:FindFirstChildOfClass("CoreGui")
  20. if cg then
  21. return cg
  22. end
  23. return lp:WaitForChild("PlayerGui")
  24. end
  25.  
  26. local folder = "NA_PromptHelper"
  27. local cfgFile = folder .. "/settings.json"
  28. local keyFile = folder .. "/keys.json"
  29.  
  30. local function hasFS()
  31. return typeof(isfile) == "function"
  32. and typeof(writefile) == "function"
  33. and typeof(readfile) == "function"
  34. and typeof(makefolder) == "function"
  35. end
  36.  
  37. if hasFS() then
  38. pcall(function()
  39. if not isfolder(folder) then
  40. makefolder(folder)
  41. end
  42. end)
  43. end
  44.  
  45. local cfg = {
  46. w = 260,
  47. h = 44,
  48. gap = 8,
  49. mode = "hold",
  50. defHold = 0.4,
  51. corner = 14,
  52. bgColor = Color3.fromRGB(16, 16, 18),
  53. bgTrans = 0.12,
  54. strokeTrans = 0.35,
  55. showBar = true,
  56. fontScale = "medium",
  57. keySize = 14,
  58. titleSize = 14,
  59. descSize = 12,
  60. align = "center",
  61. yOffset = 70,
  62. }
  63.  
  64. local loadedKeyState = nil
  65.  
  66. if hasFS() then
  67. pcall(function()
  68. if isfile(cfgFile) then
  69. local s = readfile(cfgFile)
  70. if s and s ~= "" then
  71. local t = hs:JSONDecode(s)
  72. if type(t) == "table" then
  73. for k, v in pairs(t) do
  74. if k == "bgColor" and type(v) == "table" then
  75. if #v >= 3 then
  76. cfg.bgColor = Color3.new(v[1], v[2], v[3])
  77. end
  78. elseif cfg[k] ~= nil and typeof(cfg[k]) ~= "Color3" then
  79. cfg[k] = v
  80. end
  81. end
  82. end
  83. end
  84. end
  85. end)
  86. pcall(function()
  87. if isfile(keyFile) then
  88. local s = readfile(keyFile)
  89. if s and s ~= "" then
  90. local t = hs:JSONDecode(s)
  91. if type(t) == "table" then
  92. loadedKeyState = t
  93. end
  94. end
  95. end
  96. end)
  97. end
  98.  
  99. local function applyFontScale()
  100. if cfg.fontScale == "small" then
  101. cfg.keySize = 12
  102. cfg.titleSize = 13
  103. cfg.descSize = 11
  104. elseif cfg.fontScale == "large" then
  105. cfg.keySize = 16
  106. cfg.titleSize = 17
  107. cfg.descSize = 13
  108. else
  109. cfg.keySize = 14
  110. cfg.titleSize = 14
  111. cfg.descSize = 12
  112. end
  113. end
  114.  
  115. applyFontScale()
  116.  
  117. local gui = Instance.new("ScreenGui")
  118. gui.Name = "NA_PromptOverlay"
  119. gui.ResetOnSpawn = false
  120. gui.IgnoreGuiInset = true
  121. gui.Parent = getPar()
  122.  
  123. local col = Instance.new("Frame")
  124. col.Name = "PromptColumn"
  125. col.AnchorPoint = Vector2.new(0.5, 1)
  126. col.Position = UDim2.new(0.5, 0, 1, -cfg.yOffset)
  127. col.Size = UDim2.new(0, cfg.w, 1, 0)
  128. col.BackgroundTransparency = 1
  129. col.Parent = gui
  130.  
  131. local lst = Instance.new("UIListLayout")
  132. lst.FillDirection = Enum.FillDirection.Vertical
  133. lst.HorizontalAlignment = Enum.HorizontalAlignment.Center
  134. lst.VerticalAlignment = Enum.VerticalAlignment.Bottom
  135. lst.SortOrder = Enum.SortOrder.LayoutOrder
  136. lst.Padding = UDim.new(0, cfg.gap)
  137. lst.Parent = col
  138.  
  139. local dim = Instance.new("Frame")
  140. dim.Name = "Dim"
  141. dim.Size = UDim2.fromScale(1, 1)
  142. dim.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  143. dim.BackgroundTransparency = 1
  144. dim.Visible = false
  145. dim.Parent = gui
  146.  
  147. local men = Instance.new("Frame")
  148. men.Name = "KeyMenu"
  149. men.AnchorPoint = Vector2.new(0.5, 0.5)
  150. men.Position = UDim2.fromScale(0.5, 0.5)
  151. men.Size = UDim2.new(0, 360, 0, 300)
  152. men.BackgroundColor3 = Color3.fromRGB(14, 14, 16)
  153. men.BackgroundTransparency = 0.05
  154. men.Visible = false
  155. men.Parent = gui
  156.  
  157. local mc = Instance.new("UICorner")
  158. mc.CornerRadius = UDim.new(0, 16)
  159. mc.Parent = men
  160.  
  161. local ms = Instance.new("UIStroke")
  162. ms.Thickness = 1.5
  163. ms.Transparency = 0.4
  164. ms.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  165. ms.Parent = men
  166.  
  167. local top = Instance.new("Frame")
  168. top.Name = "Top"
  169. top.BackgroundTransparency = 1
  170. top.Position = UDim2.new(0, 14, 0, 10)
  171. top.Size = UDim2.new(1, -28, 0, 52)
  172. top.Parent = men
  173.  
  174. local ttl = Instance.new("TextLabel")
  175. ttl.Name = "Title"
  176. ttl.BackgroundTransparency = 1
  177. ttl.Position = UDim2.new(0, 0, 0, 0)
  178. ttl.Size = UDim2.new(1, -40, 0, 22)
  179. ttl.Font = Enum.Font.GothamBold
  180. ttl.TextSize = 18
  181. ttl.TextColor3 = Color3.fromRGB(255, 255, 255)
  182. ttl.TextXAlignment = Enum.TextXAlignment.Left
  183. ttl.TextYAlignment = Enum.TextYAlignment.Center
  184. ttl.Text = "Prompt helper"
  185. ttl.Parent = top
  186.  
  187. local sub = Instance.new("TextLabel")
  188. sub.Name = "Sub"
  189. sub.BackgroundTransparency = 1
  190. sub.Position = UDim2.new(0, 0, 0, 22)
  191. sub.Size = UDim2.new(1, -40, 0, 18)
  192. sub.Font = Enum.Font.Gotham
  193. sub.TextSize = 13
  194. sub.TextColor3 = Color3.fromRGB(200, 200, 200)
  195. sub.TextXAlignment = Enum.TextXAlignment.Left
  196. sub.TextYAlignment = Enum.TextYAlignment.Center
  197. sub.Text = "Filter keybinds and tweak prompt UI."
  198. sub.Parent = top
  199.  
  200. local xbtn = Instance.new("TextButton")
  201. xbtn.Name = "X"
  202. xbtn.AnchorPoint = Vector2.new(1, 0)
  203. xbtn.Position = UDim2.new(1, 0, 0, 0)
  204. xbtn.Size = UDim2.new(0, 34, 0, 34)
  205. xbtn.AutoButtonColor = false
  206. xbtn.BackgroundColor3 = Color3.fromRGB(26, 26, 30)
  207. xbtn.BackgroundTransparency = 0.1
  208. xbtn.Text = "×"
  209. xbtn.Font = Enum.Font.GothamBold
  210. xbtn.TextSize = 20
  211. xbtn.TextColor3 = Color3.fromRGB(255, 255, 255)
  212. xbtn.Parent = top
  213.  
  214. local xc = Instance.new("UICorner")
  215. xc.CornerRadius = UDim.new(0, 12)
  216. xc.Parent = xbtn
  217.  
  218. local xs = Instance.new("UIStroke")
  219. xs.Thickness = 1.2
  220. xs.Transparency = 0.55
  221. xs.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  222. xs.Parent = xbtn
  223.  
  224. local tabs = Instance.new("Frame")
  225. tabs.Name = "Tabs"
  226. tabs.BackgroundTransparency = 1
  227. tabs.Position = UDim2.new(0, 14, 0, 64)
  228. tabs.Size = UDim2.new(1, -28, 0, 30)
  229. tabs.Parent = men
  230.  
  231. local tabsLay = Instance.new("UIListLayout")
  232. tabsLay.FillDirection = Enum.FillDirection.Horizontal
  233. tabsLay.HorizontalAlignment = Enum.HorizontalAlignment.Left
  234. tabsLay.VerticalAlignment = Enum.VerticalAlignment.Center
  235. tabsLay.Padding = UDim.new(0, 6)
  236. tabsLay.Parent = tabs
  237.  
  238. local function makeTab(text)
  239. local b = Instance.new("TextButton")
  240. b.AutoButtonColor = false
  241. b.BackgroundColor3 = Color3.fromRGB(26, 26, 30)
  242. b.BackgroundTransparency = 0.1
  243. b.Size = UDim2.new(0.5, -3, 1, 0)
  244. b.Font = Enum.Font.GothamSemibold
  245. b.TextSize = 14
  246. b.TextColor3 = Color3.fromRGB(220, 220, 220)
  247. b.Text = text
  248. b.Parent = tabs
  249.  
  250. local c = Instance.new("UICorner")
  251. c.CornerRadius = UDim.new(0, 10)
  252. c.Parent = b
  253.  
  254. local s = Instance.new("UIStroke")
  255. s.Thickness = 1.1
  256. s.Transparency = 0.6
  257. s.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  258. s.Parent = b
  259.  
  260. return b, s
  261. end
  262.  
  263. local tabKey, tabKeyStroke = makeTab("Keybinds")
  264. local tabSet, tabSetStroke = makeTab("Settings")
  265.  
  266. local pKey = Instance.new("Frame")
  267. pKey.Name = "PageKeybinds"
  268. pKey.BackgroundTransparency = 1
  269. pKey.Position = UDim2.new(0, 0, 0, 96)
  270. pKey.Size = UDim2.new(1, 0, 1, -96)
  271. pKey.Parent = men
  272.  
  273. local pSet = Instance.new("ScrollingFrame")
  274. pSet.Name = "PageSettings"
  275. pSet.BackgroundTransparency = 1
  276. pSet.BorderSizePixel = 0
  277. pSet.Position = pKey.Position
  278. pSet.Size = pKey.Size
  279. pSet.Visible = false
  280. pSet.CanvasSize = UDim2.new(0, 0, 0, 0)
  281. pSet.ScrollBarThickness = 6
  282. pSet.ScrollingDirection = Enum.ScrollingDirection.Y
  283. pSet.Parent = men
  284.  
  285. local srh = Instance.new("TextBox")
  286. srh.Name = "Search"
  287. srh.Position = UDim2.new(0, 14, 0, 8)
  288. srh.Size = UDim2.new(1, -28, 0, 32)
  289. srh.BackgroundColor3 = Color3.fromRGB(20, 20, 24)
  290. srh.BackgroundTransparency = 0.08
  291. srh.ClearTextOnFocus = false
  292. srh.Text = ""
  293. srh.PlaceholderText = "Search keys (E, F, Shift...)"
  294. srh.Font = Enum.Font.Gotham
  295. srh.TextSize = 14
  296. srh.TextColor3 = Color3.fromRGB(255, 255, 255)
  297. srh.PlaceholderColor3 = Color3.fromRGB(160, 160, 160)
  298. srh.TextXAlignment = Enum.TextXAlignment.Left
  299. srh.Parent = pKey
  300.  
  301. local sc = Instance.new("UICorner")
  302. sc.CornerRadius = UDim.new(0, 12)
  303. sc.Parent = srh
  304.  
  305. local ss = Instance.new("UIStroke")
  306. ss.Thickness = 1.2
  307. ss.Transparency = 0.6
  308. ss.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  309. ss.Parent = srh
  310.  
  311. local sp = Instance.new("UIPadding")
  312. sp.PaddingLeft = UDim.new(0, 10)
  313. sp.PaddingRight = UDim.new(0, 10)
  314. sp.Parent = srh
  315.  
  316. local row = Instance.new("Frame")
  317. row.Name = "Row"
  318. row.BackgroundTransparency = 1
  319. row.Position = UDim2.new(0, 14, 0, 46)
  320. row.Size = UDim2.new(1, -28, 0, 26)
  321. row.Parent = pKey
  322.  
  323. local rlay = Instance.new("UIListLayout")
  324. rlay.FillDirection = Enum.FillDirection.Horizontal
  325. rlay.HorizontalAlignment = Enum.HorizontalAlignment.Left
  326. rlay.VerticalAlignment = Enum.VerticalAlignment.Center
  327. rlay.Padding = UDim.new(0, 8)
  328. rlay.Parent = row
  329.  
  330. local function mkPill(text)
  331. local b = Instance.new("TextButton")
  332. b.AutoButtonColor = false
  333. b.BackgroundColor3 = Color3.fromRGB(26, 26, 30)
  334. b.BackgroundTransparency = 0.08
  335. b.Size = UDim2.new(0, 72, 0, 24)
  336. b.Font = Enum.Font.GothamSemibold
  337. b.TextSize = 13
  338. b.TextColor3 = Color3.fromRGB(255, 255, 255)
  339. b.Text = text
  340. b.Parent = row
  341.  
  342. local c = Instance.new("UICorner")
  343. c.CornerRadius = UDim.new(0, 999)
  344. c.Parent = b
  345.  
  346. local s = Instance.new("UIStroke")
  347. s.Thickness = 1.1
  348. s.Transparency = 0.6
  349. s.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  350. s.Parent = b
  351.  
  352. return b
  353. end
  354.  
  355. local allBtn = mkPill("Select all")
  356. local noneBtn = mkPill("Clear")
  357. local invBtn = mkPill("Invert")
  358.  
  359. local scr = Instance.new("ScrollingFrame")
  360. scr.Name = "Keys"
  361. scr.BackgroundTransparency = 1
  362. scr.BorderSizePixel = 0
  363. scr.Position = UDim2.new(0, 14, 0, 76)
  364. scr.Size = UDim2.new(1, -28, 1, -84)
  365. scr.CanvasSize = UDim2.new(0, 0, 0, 0)
  366. scr.ScrollBarThickness = 6
  367. scr.ScrollingDirection = Enum.ScrollingDirection.Y
  368. scr.Parent = pKey
  369.  
  370. local grd = Instance.new("UIGridLayout")
  371. grd.CellPadding = UDim2.new(0, 8, 0, 8)
  372. grd.SortOrder = Enum.SortOrder.LayoutOrder
  373. grd.Parent = scr
  374.  
  375. local function setGrid()
  376. local w = scr.AbsoluteSize.X
  377. local cols = math.max(3, math.min(5, math.floor((w + 8) / 84)))
  378. local cw = math.floor((w - (cols - 1) * 8) / cols)
  379. grd.CellSize = UDim2.new(0, cw, 0, 28)
  380. end
  381.  
  382. scr:GetPropertyChangedSignal("AbsoluteSize"):Connect(setGrid)
  383. grd:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  384. scr.CanvasSize = UDim2.new(0, 0, 0, grd.AbsoluteContentSize.Y + 8)
  385. end)
  386.  
  387. local setList = Instance.new("UIListLayout")
  388. setList.FillDirection = Enum.FillDirection.Vertical
  389. setList.HorizontalAlignment = Enum.HorizontalAlignment.Left
  390. setList.VerticalAlignment = Enum.VerticalAlignment.Top
  391. setList.Padding = UDim.new(0, 6)
  392. setList.Parent = pSet
  393.  
  394. setList:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  395. pSet.CanvasSize = UDim2.new(0, 0, 0, setList.AbsoluteContentSize.Y + 10)
  396. end)
  397.  
  398. local vs = workspace.CurrentCamera and workspace.CurrentCamera.ViewportSize or Vector2.new(1920, 1080)
  399.  
  400. local tog = Instance.new("TextButton")
  401. tog.Name = "KeyMenuToggle"
  402. tog.AnchorPoint = Vector2.new(0, 0)
  403. tog.Position = UDim2.fromOffset(14, vs.Y - 58)
  404. tog.Size = UDim2.new(0, 44, 0, 44)
  405. tog.AutoButtonColor = false
  406. tog.BackgroundColor3 = Color3.fromRGB(14, 14, 16)
  407. tog.BackgroundTransparency = 0.05
  408. tog.Text = ""
  409. tog.Parent = gui
  410.  
  411. local tgc = Instance.new("UICorner")
  412. tgc.CornerRadius = UDim.new(1, 0)
  413. tgc.Parent = tog
  414.  
  415. local tgs = Instance.new("UIStroke")
  416. tgs.Thickness = 1.6
  417. tgs.Transparency = 0.35
  418. tgs.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  419. tgs.Parent = tog
  420.  
  421. local ico = Instance.new("TextLabel")
  422. ico.Name = "Ico"
  423. ico.BackgroundTransparency = 1
  424. ico.Size = UDim2.fromScale(1, 1)
  425. ico.Font = Enum.Font.GothamBold
  426. ico.TextSize = 18
  427. ico.TextColor3 = Color3.fromRGB(255, 255, 255)
  428. ico.Text = "K"
  429. ico.Parent = tog
  430.  
  431. ts:Create(
  432. tog,
  433. TweenInfo.new(1.4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, -1, true),
  434. {BackgroundTransparency = 0.12}
  435. ):Play()
  436.  
  437. local map = {}
  438. local ord = 0
  439. local kst = {}
  440. local anySel = false
  441. local kbtn = {}
  442. local klist = {}
  443.  
  444. local function encodeCfg()
  445. local t = {}
  446. for k, v in pairs(cfg) do
  447. local tv = typeof(v)
  448. if tv == "Color3" then
  449. t[k] = {v.R, v.G, v.B}
  450. else
  451. t[k] = v
  452. end
  453. end
  454. return t
  455. end
  456.  
  457. local function saveCfg()
  458. if not hasFS() then
  459. return
  460. end
  461. local ok, s = pcall(function()
  462. return hs:JSONEncode(encodeCfg())
  463. end)
  464. if ok then
  465. pcall(function()
  466. writefile(cfgFile, s)
  467. end)
  468. end
  469. end
  470.  
  471. local function saveKeys()
  472. if not hasFS() then
  473. return
  474. end
  475. local t = {}
  476. for k, v in pairs(kst) do
  477. if v then
  478. t[k] = true
  479. end
  480. end
  481. local ok, s = pcall(function()
  482. return hs:JSONEncode(t)
  483. end)
  484. if ok then
  485. pcall(function()
  486. writefile(keyFile, s)
  487. end)
  488. end
  489. end
  490.  
  491. local function tw(obj, t, props)
  492. ts:Create(obj, TweenInfo.new(t, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), props):Play()
  493. end
  494.  
  495. local function low(s)
  496. return (s or ""):lower()
  497. end
  498.  
  499. local function hdur(pr)
  500. if cfg.mode == "instant" then
  501. return 0
  502. end
  503. local d = pr.HoldDuration or 0
  504. if d > 0 then
  505. return d
  506. end
  507. return cfg.defHold
  508. end
  509.  
  510. local function recAny()
  511. local v = false
  512. for _, b in pairs(kst) do
  513. if b then
  514. v = true
  515. break
  516. end
  517. end
  518. anySel = v
  519. end
  520.  
  521. local function okKey(k)
  522. if not anySel then
  523. return true
  524. end
  525. if not k then
  526. return false
  527. end
  528. return kst[k] == true
  529. end
  530.  
  531. local function refVis()
  532. for _, d in pairs(map) do
  533. local ok = okKey(d.key)
  534. if d.w then
  535. if ok then
  536. d.w.Visible = true
  537. d.w.Size = UDim2.new(1, 0, 0, cfg.h)
  538. else
  539. d.w.Visible = false
  540. d.w.Size = UDim2.new(1, 0, 0, 0)
  541. end
  542. end
  543. end
  544. end
  545.  
  546. local function restylePrompt(d)
  547. if not d.w or not d.b then
  548. return
  549. end
  550. if d.w.Visible then
  551. d.w.Size = UDim2.new(1, 0, 0, cfg.h)
  552. else
  553. d.w.Size = UDim2.new(1, 0, 0, 0)
  554. end
  555. d.b.BackgroundColor3 = cfg.bgColor
  556. d.b.BackgroundTransparency = cfg.bgTrans
  557. if d.stroke then
  558. d.stroke.Transparency = cfg.strokeTrans
  559. end
  560. if d.corner then
  561. d.corner.CornerRadius = UDim.new(0, cfg.corner)
  562. end
  563. if d.keyLbl then
  564. d.keyLbl.TextSize = cfg.keySize
  565. end
  566. if d.titleLbl then
  567. d.titleLbl.TextSize = cfg.titleSize
  568. end
  569. if d.descLbl then
  570. d.descLbl.TextSize = cfg.descSize
  571. end
  572. if d.barBg then
  573. local h = d.hd or 0
  574. d.barBg.Visible = cfg.showBar and h > 0
  575. end
  576. end
  577.  
  578. local function applyAllStyle()
  579. local y = -cfg.yOffset
  580. if cfg.align == "left" then
  581. col.AnchorPoint = Vector2.new(0, 1)
  582. col.Position = UDim2.new(0, 16, 1, y)
  583. elseif cfg.align == "right" then
  584. col.AnchorPoint = Vector2.new(1, 1)
  585. col.Position = UDim2.new(1, -16, 1, y)
  586. else
  587. col.AnchorPoint = Vector2.new(0.5, 1)
  588. col.Position = UDim2.new(0.5, 0, 1, y)
  589. end
  590. col.Size = UDim2.new(0, cfg.w, 1, 0)
  591. lst.Padding = UDim.new(0, cfg.gap)
  592. for _, d in pairs(map) do
  593. restylePrompt(d)
  594. end
  595. end
  596.  
  597. local function updK(n)
  598. local b = kbtn[n]
  599. if not b then
  600. return
  601. end
  602. local on = kst[n] == true
  603. if on then
  604. b.BackgroundColor3 = Color3.fromRGB(84, 84, 110)
  605. b.TextTransparency = 0
  606. b.TextColor3 = Color3.fromRGB(255, 255, 255)
  607. else
  608. b.BackgroundColor3 = Color3.fromRGB(26, 26, 30)
  609. b.TextTransparency = 0.15
  610. b.TextColor3 = Color3.fromRGB(230, 230, 230)
  611. end
  612. end
  613.  
  614. local function mkK(n)
  615. if kbtn[n] then
  616. return
  617. end
  618. table.insert(klist, n)
  619. local b = Instance.new("TextButton")
  620. b.Name = "K_" .. n
  621. b.AutoButtonColor = false
  622. b.BackgroundColor3 = Color3.fromRGB(26, 26, 30)
  623. b.BackgroundTransparency = 0.08
  624. b.Font = Enum.Font.GothamSemibold
  625. b.TextSize = 13
  626. b.TextColor3 = Color3.fromRGB(240, 240, 240)
  627. b.Text = n
  628. b.Parent = scr
  629.  
  630. local c = Instance.new("UICorner")
  631. c.CornerRadius = UDim.new(0, 10)
  632. c.Parent = b
  633.  
  634. local s = Instance.new("UIStroke")
  635. s.Thickness = 1.1
  636. s.Transparency = 0.6
  637. s.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  638. s.Parent = b
  639.  
  640. if loadedKeyState and loadedKeyState[n] then
  641. kst[n] = true
  642. end
  643.  
  644. kbtn[n] = b
  645. updK(n)
  646.  
  647. b.Activated:Connect(function()
  648. kst[n] = not kst[n]
  649. recAny()
  650. updK(n)
  651. refVis()
  652. saveKeys()
  653. end)
  654. end
  655.  
  656. for _, kc in ipairs(Enum.KeyCode:GetEnumItems()) do
  657. if kc ~= Enum.KeyCode.Unknown then
  658. local n = (kc.Name:gsub("^Key", ""))
  659. if n ~= "" then
  660. mkK(n)
  661. end
  662. end
  663. end
  664.  
  665. mkK("Tap")
  666. mkK("Key")
  667. setGrid()
  668. recAny()
  669. refVis()
  670.  
  671. local function refSearch()
  672. local q = low(srh.Text)
  673. if q == "" then
  674. for _, n in ipairs(klist) do
  675. local b = kbtn[n]
  676. if b then
  677. b.Visible = true
  678. end
  679. end
  680. return
  681. end
  682. for _, n in ipairs(klist) do
  683. local b = kbtn[n]
  684. if b then
  685. b.Visible = low(n):find(q, 1, true) ~= nil
  686. end
  687. end
  688. end
  689.  
  690. srh:GetPropertyChangedSignal("Text"):Connect(refSearch)
  691.  
  692. allBtn.Activated:Connect(function()
  693. for _, n in ipairs(klist) do
  694. kst[n] = true
  695. updK(n)
  696. end
  697. recAny()
  698. refVis()
  699. saveKeys()
  700. end)
  701.  
  702. noneBtn.Activated:Connect(function()
  703. for _, n in ipairs(klist) do
  704. kst[n] = nil
  705. updK(n)
  706. end
  707. recAny()
  708. refVis()
  709. saveKeys()
  710. end)
  711.  
  712. invBtn.Activated:Connect(function()
  713. for _, n in ipairs(klist) do
  714. kst[n] = not (kst[n] == true)
  715. updK(n)
  716. end
  717. recAny()
  718. refVis()
  719. saveKeys()
  720. end)
  721.  
  722. local function selectTab(which)
  723. if which == "key" then
  724. pKey.Visible = true
  725. pSet.Visible = false
  726. tabKey.BackgroundColor3 = Color3.fromRGB(60, 60, 90)
  727. tabKeyStroke.Transparency = 0.4
  728. tabKey.TextColor3 = Color3.fromRGB(255, 255, 255)
  729. tabSet.BackgroundColor3 = Color3.fromRGB(26, 26, 30)
  730. tabSetStroke.Transparency = 0.7
  731. tabSet.TextColor3 = Color3.fromRGB(210, 210, 210)
  732. else
  733. pKey.Visible = false
  734. pSet.Visible = true
  735. tabSet.BackgroundColor3 = Color3.fromRGB(60, 60, 90)
  736. tabSetStroke.Transparency = 0.4
  737. tabSet.TextColor3 = Color3.fromRGB(255, 255, 255)
  738. tabKey.BackgroundColor3 = Color3.fromRGB(26, 26, 30)
  739. tabKeyStroke.Transparency = 0.7
  740. tabKey.TextColor3 = Color3.fromRGB(210, 210, 210)
  741. end
  742. end
  743.  
  744. tabKey.Activated:Connect(function()
  745. selectTab("key")
  746. end)
  747.  
  748. tabSet.Activated:Connect(function()
  749. selectTab("settings")
  750. end)
  751.  
  752. selectTab("key")
  753.  
  754. local function makeSetting(label, getText, onNext)
  755. local f = Instance.new("Frame")
  756. f.BackgroundTransparency = 1
  757. f.Size = UDim2.new(1, -28, 0, 30)
  758. f.Parent = pSet
  759.  
  760. local lbl = Instance.new("TextLabel")
  761. lbl.BackgroundTransparency = 1
  762. lbl.Position = UDim2.new(0, 14, 0, 0)
  763. lbl.Size = UDim2.new(0.55, -14, 1, 0)
  764. lbl.Font = Enum.Font.Gotham
  765. lbl.TextSize = 14
  766. lbl.TextColor3 = Color3.fromRGB(220, 220, 220)
  767. lbl.TextXAlignment = Enum.TextXAlignment.Left
  768. lbl.TextYAlignment = Enum.TextYAlignment.Center
  769. lbl.Text = label
  770. lbl.Parent = f
  771.  
  772. local btn = Instance.new("TextButton")
  773. btn.AnchorPoint = Vector2.new(1, 0.5)
  774. btn.Position = UDim2.new(1, -14, 0.5, 0)
  775. btn.Size = UDim2.new(0.4, 0, 0, 24)
  776. btn.AutoButtonColor = false
  777. btn.BackgroundColor3 = Color3.fromRGB(26, 26, 30)
  778. btn.BackgroundTransparency = 0.08
  779. btn.Font = Enum.Font.GothamSemibold
  780. btn.TextSize = 13
  781. btn.TextColor3 = Color3.fromRGB(230, 230, 230)
  782. btn.Text = getText()
  783. btn.Parent = f
  784.  
  785. local c = Instance.new("UICorner")
  786. c.CornerRadius = UDim.new(0, 999)
  787. c.Parent = btn
  788.  
  789. local s = Instance.new("UIStroke")
  790. s.Thickness = 1.1
  791. s.Transparency = 0.6
  792. s.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  793. s.Parent = btn
  794.  
  795. btn.Activated:Connect(function()
  796. onNext()
  797. btn.Text = getText()
  798. applyFontScale()
  799. applyAllStyle()
  800. saveCfg()
  801. end)
  802. end
  803.  
  804. local modeList = {"instant", "hold"}
  805. local modeIdx = 1
  806. for i, v in ipairs(modeList) do
  807. if v == cfg.mode then
  808. modeIdx = i
  809. break
  810. end
  811. end
  812.  
  813. makeSetting("Prompt mode", function()
  814. return string.upper(string.sub(cfg.mode, 1, 1)) .. string.sub(cfg.mode, 2)
  815. end, function()
  816. modeIdx = modeIdx + 1
  817. if modeIdx > #modeList then
  818. modeIdx = 1
  819. end
  820. cfg.mode = modeList[modeIdx]
  821. end)
  822.  
  823. local heightList = {36, 44, 52}
  824. local hIdx = 1
  825. for i, v in ipairs(heightList) do
  826. if v == cfg.h then
  827. hIdx = i
  828. break
  829. end
  830. end
  831.  
  832. makeSetting("Button height", function()
  833. return tostring(cfg.h) .. " px"
  834. end, function()
  835. hIdx = hIdx + 1
  836. if hIdx > #heightList then
  837. hIdx = 1
  838. end
  839. cfg.h = heightList[hIdx]
  840. end)
  841.  
  842. local widthList = {220, 260, 300}
  843. local wIdx = 1
  844. for i, v in ipairs(widthList) do
  845. if v == cfg.w then
  846. wIdx = i
  847. break
  848. end
  849. end
  850.  
  851. makeSetting("Button width", function()
  852. return tostring(cfg.w) .. " px"
  853. end, function()
  854. wIdx = wIdx + 1
  855. if wIdx > #widthList then
  856. wIdx = 1
  857. end
  858. cfg.w = widthList[wIdx]
  859. end)
  860.  
  861. local gapList = {4, 8, 12}
  862. local gIdx = 1
  863. for i, v in ipairs(gapList) do
  864. if v == cfg.gap then
  865. gIdx = i
  866. break
  867. end
  868. end
  869.  
  870. makeSetting("Vertical gap", function()
  871. return tostring(cfg.gap) .. " px"
  872. end, function()
  873. gIdx = gIdx + 1
  874. if gIdx > #gapList then
  875. gIdx = 1
  876. end
  877. cfg.gap = gapList[gIdx]
  878. end)
  879.  
  880. local cornerList = {8, 14, 20}
  881. local cIdx = 1
  882. for i, v in ipairs(cornerList) do
  883. if v == cfg.corner then
  884. cIdx = i
  885. break
  886. end
  887. end
  888.  
  889. makeSetting("Corner radius", function()
  890. return tostring(cfg.corner) .. " px"
  891. end, function()
  892. cIdx = cIdx + 1
  893. if cIdx > #cornerList then
  894. cIdx = 1
  895. end
  896. cfg.corner = cornerList[cIdx]
  897. end)
  898.  
  899. local themeList = {"Dark", "Glass", "Solid"}
  900. local tIdx = 1
  901.  
  902. makeSetting("Background style", function()
  903. return themeList[tIdx]
  904. end, function()
  905. tIdx = tIdx + 1
  906. if tIdx > #themeList then
  907. tIdx = 1
  908. end
  909. local v = themeList[tIdx]
  910. if v == "Dark" then
  911. cfg.bgColor = Color3.fromRGB(16, 16, 18)
  912. cfg.bgTrans = 0.12
  913. cfg.strokeTrans = 0.35
  914. elseif v == "Glass" then
  915. cfg.bgColor = Color3.fromRGB(12, 12, 14)
  916. cfg.bgTrans = 0.25
  917. cfg.strokeTrans = 0.55
  918. else
  919. cfg.bgColor = Color3.fromRGB(20, 20, 22)
  920. cfg.bgTrans = 0.05
  921. cfg.strokeTrans = 0.25
  922. end
  923. end)
  924.  
  925. makeSetting("Progress bar", function()
  926. return cfg.showBar and "Enabled" or "Disabled"
  927. end, function()
  928. cfg.showBar = not cfg.showBar
  929. end)
  930.  
  931. local fontList = {"small", "medium", "large"}
  932. local fIdx = 1
  933. for i, v in ipairs(fontList) do
  934. if v == cfg.fontScale then
  935. fIdx = i
  936. break
  937. end
  938. end
  939.  
  940. makeSetting("Font scale", function()
  941. return string.upper(string.sub(cfg.fontScale, 1, 1)) .. string.sub(cfg.fontScale, 2)
  942. end, function()
  943. fIdx = fIdx + 1
  944. if fIdx > #fontList then
  945. fIdx = 1
  946. end
  947. cfg.fontScale = fontList[fIdx]
  948. end)
  949.  
  950. local alignList = {"left", "center", "right"}
  951. local aIdx = 1
  952. for i, v in ipairs(alignList) do
  953. if v == cfg.align then
  954. aIdx = i
  955. break
  956. end
  957. end
  958.  
  959. makeSetting("Column align", function()
  960. return string.upper(string.sub(cfg.align, 1, 1)) .. string.sub(cfg.align, 2)
  961. end, function()
  962. aIdx = aIdx + 1
  963. if aIdx > #alignList then
  964. aIdx = 1
  965. end
  966. cfg.align = alignList[aIdx]
  967. end)
  968.  
  969. local offsetList = {40, 70, 100, 140}
  970. local oIdx = 1
  971. for i, v in ipairs(offsetList) do
  972. if v == cfg.yOffset then
  973. oIdx = i
  974. break
  975. end
  976. end
  977.  
  978. makeSetting("Column offset", function()
  979. return tostring(cfg.yOffset) .. " px"
  980. end, function()
  981. oIdx = oIdx + 1
  982. if oIdx > #offsetList then
  983. oIdx = 1
  984. end
  985. cfg.yOffset = offsetList[oIdx]
  986. end)
  987.  
  988. applyAllStyle()
  989. saveCfg()
  990.  
  991. local function firePrompt(pr, hd)
  992. if not pr or not pr:IsDescendantOf(game) then
  993. return
  994. end
  995. if typeof(fireproximityprompt) == "function" then
  996. if hd > 0 then
  997. task.delay(hd, function()
  998. if pr and pr:IsDescendantOf(game) then
  999. pcall(function()
  1000. fireproximityprompt(pr)
  1001. end)
  1002. end
  1003. end)
  1004. else
  1005. pcall(function()
  1006. fireproximityprompt(pr)
  1007. end)
  1008. end
  1009. else
  1010. if hd > 0 then
  1011. pcall(function()
  1012. pps:InputHoldBegin(pr)
  1013. end)
  1014. task.delay(hd, function()
  1015. if pr and pr:IsDescendantOf(game) then
  1016. pcall(function()
  1017. pps:InputHoldEnd(pr)
  1018. end)
  1019. end
  1020. end)
  1021. else
  1022. pcall(function()
  1023. pps:InputHoldBegin(pr)
  1024. end)
  1025. task.delay(0.05, function()
  1026. if pr and pr:IsDescendantOf(game) then
  1027. pcall(function()
  1028. pps:InputHoldEnd(pr)
  1029. end)
  1030. end
  1031. end)
  1032. end
  1033. end
  1034. end
  1035.  
  1036. local function rm(pr)
  1037. local d = map[pr]
  1038. if not d then
  1039. return
  1040. end
  1041. map[pr] = nil
  1042. if d.c then
  1043. for _, x in ipairs(d.c) do
  1044. pcall(function()
  1045. x:Disconnect()
  1046. end)
  1047. end
  1048. end
  1049. if d.w and d.w.Parent then
  1050. d.w:Destroy()
  1051. end
  1052. end
  1053.  
  1054. local function add(pr)
  1055. if not pr or map[pr] then
  1056. return
  1057. end
  1058. ord = ord - 1
  1059.  
  1060. local w = Instance.new("Frame")
  1061. w.Name = "PromptWrap"
  1062. w.Size = UDim2.new(1, 0, 0, cfg.h)
  1063. w.BackgroundTransparency = 1
  1064. w.LayoutOrder = ord
  1065. w.Parent = col
  1066.  
  1067. local b = Instance.new("TextButton")
  1068. b.Name = "PromptBtn"
  1069. b.AnchorPoint = Vector2.new(0.5, 0.5)
  1070. b.Position = UDim2.new(0.5, 0, 0.5, 0)
  1071. b.Size = UDim2.new(1, 0, 1, 0)
  1072. b.AutoButtonColor = false
  1073. b.BackgroundColor3 = cfg.bgColor
  1074. b.BackgroundTransparency = cfg.bgTrans
  1075. b.Text = ""
  1076. b.Parent = w
  1077.  
  1078. local bc = Instance.new("UICorner")
  1079. bc.CornerRadius = UDim.new(0, cfg.corner)
  1080. bc.Parent = b
  1081.  
  1082. local bs = Instance.new("UIStroke")
  1083. bs.Thickness = 1.2
  1084. bs.Transparency = cfg.strokeTrans
  1085. bs.ApplyStrokeMode = Enum.ApplyStrokeMode.Border
  1086. bs.Parent = b
  1087.  
  1088. local kl = Instance.new("TextLabel")
  1089. kl.Name = "Key"
  1090. kl.BackgroundTransparency = 1
  1091. kl.Position = UDim2.new(0, 12, 0, 3)
  1092. kl.Size = UDim2.new(0, 58, 0, 16)
  1093. kl.Font = Enum.Font.GothamBold
  1094. kl.TextSize = cfg.keySize
  1095. kl.TextColor3 = Color3.fromRGB(255, 255, 255)
  1096. kl.TextXAlignment = Enum.TextXAlignment.Left
  1097. kl.TextYAlignment = Enum.TextYAlignment.Center
  1098. kl.Parent = b
  1099.  
  1100. local tl = Instance.new("TextLabel")
  1101. tl.Name = "Title"
  1102. tl.BackgroundTransparency = 1
  1103. tl.Position = UDim2.new(0, 70, 0, 3)
  1104. tl.Size = UDim2.new(1, -82, 0, 16)
  1105. tl.Font = Enum.Font.GothamSemibold
  1106. tl.TextSize = cfg.titleSize
  1107. tl.TextColor3 = Color3.fromRGB(255, 255, 255)
  1108. tl.TextXAlignment = Enum.TextXAlignment.Left
  1109. tl.TextYAlignment = Enum.TextYAlignment.Center
  1110. tl.TextTruncate = Enum.TextTruncate.AtEnd
  1111. tl.Parent = b
  1112.  
  1113. local dl = Instance.new("TextLabel")
  1114. dl.Name = "Desc"
  1115. dl.BackgroundTransparency = 1
  1116. dl.Position = UDim2.new(0, 12, 0, 19)
  1117. dl.Size = UDim2.new(1, -24, 0, 16)
  1118. dl.Font = Enum.Font.Gotham
  1119. dl.TextSize = cfg.descSize
  1120. dl.TextColor3 = Color3.fromRGB(210, 210, 210)
  1121. dl.TextXAlignment = Enum.TextXAlignment.Left
  1122. dl.TextYAlignment = Enum.TextYAlignment.Top
  1123. dl.TextWrapped = true
  1124. dl.Parent = b
  1125.  
  1126. local bg = Instance.new("Frame")
  1127. bg.Name = "BarBg"
  1128. bg.Position = UDim2.new(0, 12, 1, -3)
  1129. bg.Size = UDim2.new(1, -24, 0, 2)
  1130. bg.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  1131. bg.BackgroundTransparency = 0.88
  1132. bg.Parent = b
  1133.  
  1134. local bgc = Instance.new("UICorner")
  1135. bgc.CornerRadius = UDim.new(1, 0)
  1136. bgc.Parent = bg
  1137.  
  1138. local br = Instance.new("Frame")
  1139. br.Name = "Bar"
  1140. br.Size = UDim2.new(0, 0, 1, 0)
  1141. br.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  1142. br.BackgroundTransparency = 0.2
  1143. br.Parent = bg
  1144.  
  1145. local brc = Instance.new("UICorner")
  1146. brc.CornerRadius = UDim.new(1, 0)
  1147. brc.Parent = br
  1148.  
  1149. local con = {}
  1150. local busy = false
  1151.  
  1152. map[pr] = {
  1153. pr = pr,
  1154. w = w,
  1155. b = b,
  1156. c = con,
  1157. key = "",
  1158. keyLbl = kl,
  1159. titleLbl = tl,
  1160. descLbl = dl,
  1161. barBg = bg,
  1162. bar = br,
  1163. stroke = bs,
  1164. corner = bc,
  1165. hd = 0,
  1166. }
  1167.  
  1168. local function ktxtLocal()
  1169. local k = pr.KeyboardKeyCode
  1170. if not k or k == Enum.KeyCode.Unknown then
  1171. if uis.TouchEnabled and not uis.KeyboardEnabled then
  1172. return "Tap"
  1173. end
  1174. return "Key"
  1175. end
  1176. return (k.Name:gsub("^Key", ""))
  1177. end
  1178.  
  1179. local function ttxtLocal()
  1180. local o = pr.ObjectText or ""
  1181. if o ~= "" then
  1182. return o
  1183. end
  1184. local a = pr.ActionText or ""
  1185. if a ~= "" then
  1186. return a
  1187. end
  1188. return "Interact"
  1189. end
  1190.  
  1191. local function dtxtLocal()
  1192. local a = pr.ActionText or ""
  1193. if a ~= "" then
  1194. return a
  1195. end
  1196. return ""
  1197. end
  1198.  
  1199. local function refresh()
  1200. local keyName = ktxtLocal()
  1201. local d = map[pr]
  1202. if not d then
  1203. return
  1204. end
  1205. d.key = keyName
  1206. kl.Text = keyName
  1207. tl.Text = ttxtLocal()
  1208. dl.Text = dtxtLocal()
  1209. if not kbtn[keyName] then
  1210. mkK(keyName)
  1211. end
  1212. local hd = hdur(pr)
  1213. d.hd = hd
  1214. if cfg.showBar and hd > 0 then
  1215. bg.Visible = true
  1216. else
  1217. bg.Visible = false
  1218. end
  1219. if hd <= 0 then
  1220. br.Size = UDim2.new(0, 0, 1, 0)
  1221. end
  1222. local ok = okKey(keyName)
  1223. if ok then
  1224. w.Visible = true
  1225. w.Size = UDim2.new(1, 0, 0, cfg.h)
  1226. else
  1227. w.Visible = false
  1228. w.Size = UDim2.new(1, 0, 0, 0)
  1229. end
  1230. end
  1231.  
  1232. local function activated()
  1233. if busy then
  1234. return
  1235. end
  1236. if not pr or not pr:IsDescendantOf(game) then
  1237. rm(pr)
  1238. return
  1239. end
  1240. if not okKey(map[pr].key) then
  1241. return
  1242. end
  1243.  
  1244. busy = true
  1245. tw(b, 0.08, {Size = UDim2.new(1, -10, 1, -4)})
  1246.  
  1247. local hd = hdur(pr)
  1248. if hd > 0 then
  1249. br.Size = UDim2.new(0, 0, 1, 0)
  1250. bg.Visible = cfg.showBar
  1251. if cfg.showBar then
  1252. tw(br, hd, {Size = UDim2.new(1, 0, 1, 0)})
  1253. end
  1254. else
  1255. bg.Visible = false
  1256. br.Size = UDim2.new(1, 0, 1, 0)
  1257. tw(br, 0.12, {Size = UDim2.new(0, 0, 1, 0)})
  1258. end
  1259.  
  1260. firePrompt(pr, hd)
  1261.  
  1262. task.delay(math.max(hd, 0.15), function()
  1263. if b.Parent then
  1264. tw(b, 0.12, {Size = UDim2.new(1, 0, 1, 0)})
  1265. end
  1266. busy = false
  1267. end)
  1268. end
  1269.  
  1270. table.insert(con, b.Activated:Connect(activated))
  1271. table.insert(con, pr:GetPropertyChangedSignal("ActionText"):Connect(refresh))
  1272. table.insert(con, pr:GetPropertyChangedSignal("ObjectText"):Connect(refresh))
  1273. table.insert(con, pr:GetPropertyChangedSignal("KeyboardKeyCode"):Connect(refresh))
  1274. table.insert(con, pr:GetPropertyChangedSignal("HoldDuration"):Connect(refresh))
  1275. table.insert(con, pr.AncestryChanged:Connect(function()
  1276. if not pr:IsDescendantOf(game) then
  1277. rm(pr)
  1278. end
  1279. end))
  1280.  
  1281. refresh()
  1282.  
  1283. if pr.Style ~= Enum.ProximityPromptStyle.Custom then
  1284. pcall(function()
  1285. pr.Style = Enum.ProximityPromptStyle.Custom
  1286. end)
  1287. end
  1288. end
  1289.  
  1290. pps.PromptShown:Connect(add)
  1291. pps.PromptHidden:Connect(rm)
  1292.  
  1293. local function openMen(open)
  1294. if open then
  1295. dim.Visible = true
  1296. men.Visible = true
  1297. tog.Visible = false
  1298. dim.BackgroundTransparency = 1
  1299. men.BackgroundTransparency = 1
  1300. local target = UDim2.fromScale(0.5, 0.5)
  1301. men.Position = UDim2.new(target.X.Scale, target.X.Offset, target.Y.Scale, target.Y.Offset + 10)
  1302. men.Size = UDim2.new(0, 340, 0, 280)
  1303. tw(dim, 0.2, {BackgroundTransparency = 0.45})
  1304. tw(men, 0.2, {BackgroundTransparency = 0.05, Position = target, Size = UDim2.new(0, 360, 0, 300)})
  1305. else
  1306. if not men.Visible then
  1307. return
  1308. end
  1309. tog.Visible = true
  1310. local p0 = men.Position
  1311. tw(dim, 0.15, {BackgroundTransparency = 1})
  1312. tw(men, 0.15, {
  1313. BackgroundTransparency = 1,
  1314. Position = UDim2.new(p0.X.Scale, p0.X.Offset, p0.Y.Scale, p0.Y.Offset + 10),
  1315. Size = UDim2.new(0, 340, 0, 280),
  1316. })
  1317. task.delay(0.16, function()
  1318. if dim then
  1319. dim.Visible = false
  1320. end
  1321. if men then
  1322. men.Visible = false
  1323. end
  1324. end)
  1325. end
  1326. end
  1327.  
  1328. xbtn.Activated:Connect(function()
  1329. openMen(false)
  1330. end)
  1331.  
  1332. dim.InputBegan:Connect(function(i)
  1333. if not men.Visible then
  1334. return
  1335. end
  1336. if i.UserInputType == Enum.UserInputType.Touch or i.UserInputType == Enum.UserInputType.MouseButton1 then
  1337. local pos = i.Position
  1338. local p = Vector2.new(pos.X, pos.Y)
  1339. local mPos = men.AbsolutePosition
  1340. local mSize = men.AbsoluteSize
  1341. local inside = p.X >= mPos.X and p.X <= mPos.X + mSize.X and p.Y >= mPos.Y and p.Y <= mPos.Y + mSize.Y
  1342. if not inside then
  1343. openMen(false)
  1344. end
  1345. end
  1346. end)
  1347.  
  1348. do
  1349. local dragging = false
  1350. local moved = false
  1351. local active = nil
  1352. local dragStart
  1353. local startPos
  1354. local threshold = 6
  1355.  
  1356. tog.InputBegan:Connect(function(input)
  1357. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  1358. dragging = true
  1359. moved = false
  1360. active = input
  1361. dragStart = input.Position
  1362. startPos = tog.Position
  1363. end
  1364. end)
  1365.  
  1366. uis.InputChanged:Connect(function(input)
  1367. if not dragging or input ~= active then
  1368. return
  1369. end
  1370. if input.UserInputType ~= Enum.UserInputType.MouseMovement and input.UserInputType ~= Enum.UserInputType.Touch then
  1371. return
  1372. end
  1373.  
  1374. local delta = input.Position - dragStart
  1375. if not moved and (math.abs(delta.X) + math.abs(delta.Y)) < threshold then
  1376. return
  1377. end
  1378. moved = true
  1379.  
  1380. local cam = workspace.CurrentCamera
  1381. local v = cam and cam.ViewportSize or Vector2.new(1920, 1080)
  1382. local sz = tog.AbsoluteSize
  1383.  
  1384. local x = startPos.X.Offset + delta.X
  1385. local y = startPos.Y.Offset + delta.Y
  1386.  
  1387. local minX = 0
  1388. local maxX = v.X - sz.X
  1389. local minY = 0
  1390. local maxY = v.Y - sz.Y
  1391.  
  1392. x = math.clamp(x, minX, maxX)
  1393. y = math.clamp(y, minY, maxY)
  1394.  
  1395. tog.Position = UDim2.fromOffset(x, y)
  1396. end)
  1397.  
  1398. uis.InputEnded:Connect(function(input)
  1399. if input ~= active then
  1400. return
  1401. end
  1402. dragging = false
  1403. active = nil
  1404. if not moved then
  1405. openMen(not men.Visible)
  1406. end
  1407. end)
  1408. end
Add Comment
Please, Sign In to add comment