MaxproGlitcher

Script Api ScriptBlox

Jun 13th, 2026
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.11 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local TweenService = game:GetService("TweenService")
  3. local HttpService = game:GetService("HttpService")
  4. local UserInputService = game:GetService("UserInputService")
  5. local MarketplaceService = game:GetService("MarketplaceService")
  6. local LocalPlayer = Players.LocalPlayer
  7. local PlayerGui = LocalPlayer:WaitForChild("PlayerGui")
  8.  
  9. -- FREE UP MOBILE STORAGE: Clean up old folders from previous versions
  10. pcall(function()
  11. if isfolder and delfolder then
  12. if isfolder(".ScriptBlox_Thumbnails") then delfolder(".ScriptBlox_Thumbnails") end
  13. if isfolder("ScriptBlox_Thumbnails") then delfolder("ScriptBlox_Thumbnails") end
  14. end
  15. end)
  16.  
  17. if PlayerGui:FindFirstChild("ScriptBloxUI") then
  18. PlayerGui.ScriptBloxUI:Destroy()
  19. end
  20.  
  21. local UITransparency = 0.3
  22.  
  23. local Colors = {
  24. Background = Color3.fromRGB(17, 17, 27),
  25. Secondary = Color3.fromRGB(24, 24, 37),
  26. Card = Color3.fromRGB(30, 30, 46),
  27. Primary = Color3.fromRGB(137, 180, 250),
  28. Green = Color3.fromRGB(166, 227, 161),
  29. Red = Color3.fromRGB(243, 139, 168),
  30. Yellow = Color3.fromRGB(249, 226, 175),
  31. Orange = Color3.fromRGB(250, 179, 135),
  32. Purple = Color3.fromRGB(203, 166, 247),
  33. Teal = Color3.fromRGB(148, 226, 213),
  34. Pink = Color3.fromRGB(245, 194, 231),
  35. Cyan = Color3.fromRGB(137, 220, 235),
  36. Text = Color3.fromRGB(205, 214, 244),
  37. SubText = Color3.fromRGB(147, 153, 178),
  38. Border = Color3.fromRGB(49, 50, 68),
  39. Dislike = Color3.fromRGB(150, 150, 150),
  40. }
  41.  
  42. local TabData = {
  43. Free = { page = 1, hasMore = true, isLoading = false, totalLoaded = 0, totalApi = 0, query = nil, seen = {} },
  44. ThisGame = { page = 1, hasMore = true, isLoading = false, totalLoaded = 0, totalApi = 0, query = nil, seen = {} },
  45. Search = { page = 1, hasMore = true, isLoading = false, totalLoaded = 0, totalApi = 0, query = nil, seen = {} }
  46. }
  47. local CurrentTab = "Free"
  48. local maxPerPage = 50
  49.  
  50. local CurrentGameId = game.PlaceId
  51. local CurrentGameName = "Unknown Game"
  52. local currentScriptForView = ""
  53. local currentUrlForView = ""
  54. local isUIDraggable = true
  55.  
  56. local function SplitString(str, delim)
  57. local result = {}
  58. for match in (str..delim):gmatch("(.-)"..delim) do table.insert(result, match) end
  59. return result
  60. end
  61.  
  62. local function FormatNumber(num)
  63. if not num or num == 0 then return "0" end
  64. if num >= 1000000 then return string.format("%.1fM", num / 1000000):gsub("%.0M", "M")
  65. elseif num >= 1000 then return string.format("%.1fK", num / 1000):gsub("%.0K", "K") end
  66. return tostring(num)
  67. end
  68.  
  69. local function FormatTimeAgo(dateString)
  70. if not dateString then return "?" end
  71. local ok, result = pcall(function()
  72. local y, mo, d, h, mi, s = dateString:match("(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+)")
  73. if not y then return "?" end
  74. local t = os.time({year=tonumber(y), month=tonumber(mo), day=tonumber(d), hour=tonumber(h), min=tonumber(mi), sec=tonumber(s)})
  75. local diff = os.time() - t
  76. if diff < 60 then return "now"
  77. elseif diff < 3600 then return math.floor(diff/60).."m"
  78. elseif diff < 86400 then return math.floor(diff/3600).."h"
  79. elseif diff < 604800 then return math.floor(diff/86400).."d"
  80. else return math.floor(diff/604800).."w" end
  81. end)
  82. return ok and result or "?"
  83. end
  84.  
  85. local function GetScriptUrl(data)
  86. if data.slug and data.slug ~= "" then return "https://scriptblox.com/script/" .. data.slug
  87. elseif data._id and data._id ~= "" then return "https://scriptblox.com/script/" .. data._id end
  88. return "https://scriptblox.com/"
  89. end
  90.  
  91. local function GetCurrentGameInfo()
  92. local gameId = game.PlaceId
  93. local gameName = "Unknown Game"
  94. pcall(function()
  95. local info = MarketplaceService:GetProductInfo(gameId)
  96. if info and info.Name then gameName = info.Name end
  97. end)
  98. return gameId, gameName
  99. end
  100.  
  101. local function HttpRequest(url)
  102. local ok, res = pcall(function()
  103. local req = syn and syn.request or http_request or request or (http and http.request)
  104. if req then
  105. local r = req({Url=url, Method="GET"})
  106. if r and (r.Body or r.body) then return HttpService:JSONDecode(r.Body or r.body) end
  107. end
  108. end)
  109. return ok and res or nil
  110. end
  111.  
  112. -- ==========================================
  113. -- GHOST IMAGE LOADER (0 MB STORAGE USED)
  114. -- ==========================================
  115. local MemoryCache = {}
  116. local function GetTempImageAsset(url)
  117. if not url or url == "" then return nil end
  118. if MemoryCache[url] then return MemoryCache[url] end
  119.  
  120. local requestFunc = syn and syn.request or http_request or request or (http and http.request)
  121. local gca = getcustomasset or getsynasset
  122. if not requestFunc or not writefile or not gca or not delfile then return nil end
  123.  
  124. local success, result = pcall(function()
  125. local res = requestFunc({Url = url, Method = "GET"})
  126. if res and (res.StatusCode == 200 or res.Success) then
  127. -- Create a random temporary file name
  128. local tempFileName = "sb_ghost_" .. tostring(tick()):gsub("%.","") .. math.random(1000, 9999) .. ".png"
  129.  
  130. -- Write the file just for a millisecond to inject it
  131. writefile(tempFileName, res.Body or res.body)
  132. local assetId = gca(tempFileName)
  133.  
  134. -- INSTANTLY DELETE THE FILE so it never takes up your phone's storage
  135. pcall(function() delfile(tempFileName) end)
  136.  
  137. if assetId then
  138. MemoryCache[url] = assetId -- Save to script memory so it doesn't re-download
  139. end
  140.  
  141. return assetId
  142. end
  143. end)
  144.  
  145. return success and result or nil
  146. end
  147. -- ==========================================
  148.  
  149. local function CopyToClipboard(text)
  150. pcall(function()
  151. if setclipboard then setclipboard(text)
  152. elseif toclipboard then toclipboard(text)
  153. elseif Clipboard and Clipboard.set then Clipboard.set(text) end
  154. end)
  155. end
  156.  
  157. -- GUI Setup
  158. local ScreenGui = Instance.new("ScreenGui")
  159. ScreenGui.Name = "ScriptBloxUI"
  160. ScreenGui.ResetOnSpawn = false
  161. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  162. ScreenGui.DisplayOrder = 5
  163. ScreenGui.Parent = PlayerGui
  164.  
  165. local MainFrame = Instance.new("Frame")
  166. MainFrame.Name = "Main"
  167. MainFrame.Size = UDim2.new(0, 520, 0, 420)
  168. MainFrame.Position = UDim2.new(0.5, -260, 0.5, -210)
  169. MainFrame.BackgroundColor3 = Colors.Background
  170. MainFrame.BackgroundTransparency = UITransparency
  171. MainFrame.BorderSizePixel = 0
  172. MainFrame.ClipsDescendants = true
  173. MainFrame.Parent = ScreenGui
  174. MainFrame.Active = true
  175. Instance.new("UICorner", MainFrame).CornerRadius = UDim.new(0, 16)
  176. Instance.new("UIStroke", MainFrame).Color = Colors.Border
  177.  
  178. local ToggleBtn = Instance.new("TextButton")
  179. ToggleBtn.Name = "Toggle"
  180. ToggleBtn.Size = UDim2.new(0, 60, 0, 60)
  181. ToggleBtn.Position = UDim2.new(1, -80, 0.5, -30)
  182. ToggleBtn.BackgroundColor3 = Colors.Primary
  183. ToggleBtn.BackgroundTransparency = 0.75
  184. ToggleBtn.Text = ""
  185. ToggleBtn.Visible = false
  186. ToggleBtn.ZIndex = 100
  187. ToggleBtn.Parent = ScreenGui
  188. ToggleBtn.Active = true
  189. Instance.new("UICorner", ToggleBtn).CornerRadius = UDim.new(1, 0)
  190. Instance.new("UIStroke", ToggleBtn).Color = Colors.Text
  191.  
  192. local ToggleIcon = Instance.new("ImageLabel")
  193. ToggleIcon.Size = UDim2.new(0, 32, 0, 32)
  194. ToggleIcon.Position = UDim2.new(0.5, -16, 0.5, -16)
  195. ToggleIcon.BackgroundTransparency = 1
  196. ToggleIcon.Image = "rbxassetid://93664761702799"
  197. ToggleIcon.ScaleType = Enum.ScaleType.Fit
  198. ToggleIcon.ZIndex = 101
  199. ToggleIcon.Parent = ToggleBtn
  200.  
  201. local function Dragify(frame, dragHandle)
  202. dragHandle = dragHandle or frame
  203. local dragging = false
  204. local dragInput, dragStart, startPos
  205.  
  206. dragHandle.InputBegan:Connect(function(input)
  207. if frame == MainFrame and not isUIDraggable then return end
  208.  
  209. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  210. dragging = true
  211. dragInput = input
  212. dragStart = input.Position
  213. startPos = frame.Position
  214.  
  215. input.Changed:Connect(function()
  216. if input.UserInputState == Enum.UserInputState.End then
  217. dragging = false
  218. end
  219. end)
  220. end
  221. end)
  222.  
  223. dragHandle.InputChanged:Connect(function(input)
  224. if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
  225. dragInput = input
  226. end
  227. end)
  228.  
  229. UserInputService.InputChanged:Connect(function(input)
  230. if input == dragInput and dragging then
  231. local delta = input.Position - dragStart
  232. frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
  233. end
  234. end)
  235. end
  236.  
  237. local Header = Instance.new("Frame")
  238. Header.Size = UDim2.new(1, 0, 0, 45)
  239. Header.BackgroundColor3 = Colors.Secondary
  240. Header.BackgroundTransparency = UITransparency
  241. Header.Parent = MainFrame
  242. Header.Active = true
  243. Instance.new("UICorner", Header).CornerRadius = UDim.new(0, 16)
  244.  
  245. local BottomDragBar = Instance.new("Frame", MainFrame)
  246. BottomDragBar.Size = UDim2.new(1, 0, 0, 20)
  247. BottomDragBar.Position = UDim2.new(0, 0, 1, -20)
  248. BottomDragBar.BackgroundTransparency = 1
  249. BottomDragBar.Active = true
  250.  
  251. local DragPill = Instance.new("Frame", BottomDragBar)
  252. DragPill.Size = UDim2.new(0, 40, 0, 4)
  253. DragPill.Position = UDim2.new(0.5, -20, 0.5, -2)
  254. DragPill.BackgroundColor3 = Colors.SubText
  255. DragPill.BackgroundTransparency = 0.5
  256. Instance.new("UICorner", DragPill).CornerRadius = UDim.new(1, 0)
  257.  
  258. Dragify(MainFrame, Header)
  259. Dragify(MainFrame, BottomDragBar)
  260. Dragify(MainFrame, MainFrame)
  261. Dragify(ToggleBtn, ToggleBtn)
  262.  
  263. local toggleClickStart
  264. ToggleBtn.InputBegan:Connect(function(input)
  265. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then toggleClickStart = input.Position end
  266. end)
  267. ToggleBtn.InputEnded:Connect(function(input)
  268. if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
  269. if toggleClickStart and (input.Position - toggleClickStart).Magnitude < 10 then
  270. MainFrame.Visible = true; ToggleBtn.Visible = false
  271. end
  272. end
  273. end)
  274.  
  275. local LogoIcon = Instance.new("ImageLabel")
  276. LogoIcon.Size = UDim2.new(0, 22, 0, 22)
  277. LogoIcon.Position = UDim2.new(0, 12, 0.5, -11)
  278. LogoIcon.BackgroundTransparency = 1
  279. LogoIcon.Image = "rbxassetid://93664761702799"
  280. LogoIcon.ScaleType = Enum.ScaleType.Fit
  281. LogoIcon.Parent = Header
  282.  
  283. local Logo = Instance.new("TextLabel")
  284. Logo.Size = UDim2.new(0, 80, 0, 45)
  285. Logo.Position = UDim2.new(0, 40, 0, 0)
  286. Logo.BackgroundTransparency = 1
  287. Logo.Text = "ScriptBlox"
  288. Logo.TextColor3 = Colors.Text
  289. Logo.TextSize = 14
  290. Logo.Font = Enum.Font.GothamBold
  291. Logo.TextXAlignment = Enum.TextXAlignment.Left
  292. Logo.Parent = Header
  293.  
  294. local SearchFrame = Instance.new("Frame")
  295. SearchFrame.Size = UDim2.new(0, 200, 0, 28)
  296. SearchFrame.Position = UDim2.new(0, 125, 0.5, -14)
  297. SearchFrame.BackgroundColor3 = Colors.Background
  298. SearchFrame.BackgroundTransparency = UITransparency
  299. SearchFrame.Parent = Header
  300. Instance.new("UICorner", SearchFrame).CornerRadius = UDim.new(1, 0)
  301.  
  302. local SearchBox = Instance.new("TextBox")
  303. SearchBox.Size = UDim2.new(1, -55, 1, 0)
  304. SearchBox.Position = UDim2.new(0, 8, 0, 0)
  305. SearchBox.BackgroundTransparency = 1
  306. SearchBox.PlaceholderText = "Search scripts..."
  307. SearchBox.TextColor3 = Colors.Text
  308. SearchBox.TextSize = 11
  309. SearchBox.Font = Enum.Font.Gotham
  310. SearchBox.TextXAlignment = Enum.TextXAlignment.Left
  311. SearchBox.ClearTextOnFocus = false
  312. SearchBox.Text = ""
  313. SearchBox.Parent = SearchFrame
  314.  
  315. local ClearBtn = Instance.new("TextButton")
  316. ClearBtn.Size = UDim2.new(0, 24, 1, 0)
  317. ClearBtn.Position = UDim2.new(1, -54, 0, 0)
  318. ClearBtn.BackgroundColor3 = Colors.Card
  319. ClearBtn.BackgroundTransparency = 0.5
  320. ClearBtn.Text = "๐Ÿ—‘๏ธ"
  321. ClearBtn.TextColor3 = Colors.Text
  322. ClearBtn.TextSize = 12
  323. ClearBtn.Font = Enum.Font.GothamBold
  324. ClearBtn.Parent = SearchFrame
  325. Instance.new("UICorner", ClearBtn).CornerRadius = UDim.new(1, 0)
  326. ClearBtn.MouseButton1Click:Connect(function() SearchBox.Text = "" end)
  327.  
  328. local SearchBtn = Instance.new("TextButton")
  329. SearchBtn.Size = UDim2.new(0, 26, 1, 0)
  330. SearchBtn.Position = UDim2.new(1, -26, 0, 0)
  331. SearchBtn.BackgroundColor3 = Colors.Primary
  332. SearchBtn.Text = "โ†’"
  333. SearchBtn.TextColor3 = Colors.Background
  334. SearchBtn.TextSize = 14
  335. SearchBtn.Font = Enum.Font.GothamBold
  336. SearchBtn.Parent = SearchFrame
  337. Instance.new("UICorner", SearchBtn).CornerRadius = UDim.new(1, 0)
  338.  
  339. local ConfirmOverlay = Instance.new("Frame")
  340. ConfirmOverlay.Size = UDim2.new(1, 0, 1, 0)
  341. ConfirmOverlay.BackgroundColor3 = Color3.new(0,0,0)
  342. ConfirmOverlay.BackgroundTransparency = 0.5
  343. ConfirmOverlay.Visible = false
  344. ConfirmOverlay.ZIndex = 80
  345. ConfirmOverlay.Parent = MainFrame
  346. ConfirmOverlay.Active = true
  347.  
  348. local ConfirmBox = Instance.new("Frame")
  349. ConfirmBox.Size = UDim2.new(0, 280, 0, 130)
  350. ConfirmBox.Position = UDim2.new(0.5, -140, 0.5, -65)
  351. ConfirmBox.BackgroundColor3 = Colors.Card
  352. ConfirmBox.ZIndex = 81
  353. ConfirmBox.Parent = ConfirmOverlay
  354. Instance.new("UICorner", ConfirmBox).CornerRadius = UDim.new(0, 12)
  355. Instance.new("UIStroke", ConfirmBox).Color = Colors.Border
  356.  
  357. local ConfirmText = Instance.new("TextLabel")
  358. ConfirmText.Size = UDim2.new(1, -20, 0, 60)
  359. ConfirmText.Position = UDim2.new(0, 10, 0, 15)
  360. ConfirmText.BackgroundTransparency = 1
  361. ConfirmText.Text = "Are you sure about removing the UI?"
  362. ConfirmText.TextColor3 = Colors.Text
  363. ConfirmText.TextSize = 13
  364. ConfirmText.Font = Enum.Font.GothamBold
  365. ConfirmText.TextWrapped = true
  366. ConfirmText.ZIndex = 82
  367. ConfirmText.Parent = ConfirmBox
  368.  
  369. local ConfirmYes = Instance.new("TextButton")
  370. ConfirmYes.Size = UDim2.new(0, 110, 0, 32)
  371. ConfirmYes.Position = UDim2.new(0.5, -120, 1, -45)
  372. ConfirmYes.BackgroundColor3 = Colors.Red
  373. ConfirmYes.Text = "Yes"
  374. ConfirmYes.TextColor3 = Colors.Text
  375. ConfirmYes.Font = Enum.Font.GothamBold
  376. ConfirmYes.ZIndex = 82
  377. ConfirmYes.Parent = ConfirmBox
  378. Instance.new("UICorner", ConfirmYes).CornerRadius = UDim.new(1, 0)
  379.  
  380. local ConfirmCancel = Instance.new("TextButton")
  381. ConfirmCancel.Size = UDim2.new(0, 110, 0, 32)
  382. ConfirmCancel.Position = UDim2.new(0.5, 10, 1, -45)
  383. ConfirmCancel.BackgroundColor3 = Colors.Secondary
  384. ConfirmCancel.Text = "Cancel"
  385. ConfirmCancel.TextColor3 = Colors.Text
  386. ConfirmCancel.Font = Enum.Font.GothamBold
  387. ConfirmCancel.ZIndex = 82
  388. ConfirmCancel.Parent = ConfirmBox
  389. Instance.new("UICorner", ConfirmCancel).CornerRadius = UDim.new(1, 0)
  390.  
  391. ConfirmYes.MouseButton1Click:Connect(function() ScreenGui:Destroy() end)
  392. ConfirmCancel.MouseButton1Click:Connect(function() ConfirmOverlay.Visible = false end)
  393.  
  394. local ExecConfirmOverlay = Instance.new("Frame")
  395. ExecConfirmOverlay.Size = UDim2.new(1, 0, 1, 0)
  396. ExecConfirmOverlay.BackgroundColor3 = Color3.new(0,0,0)
  397. ExecConfirmOverlay.BackgroundTransparency = 0.5
  398. ExecConfirmOverlay.Visible = false
  399. ExecConfirmOverlay.ZIndex = 90
  400. ExecConfirmOverlay.Parent = MainFrame
  401. ExecConfirmOverlay.Active = true
  402.  
  403. local ExecConfirmBox = Instance.new("Frame")
  404. ExecConfirmBox.Size = UDim2.new(0, 280, 0, 140)
  405. ExecConfirmBox.Position = UDim2.new(0.5, -140, 0.5, -70)
  406. ExecConfirmBox.BackgroundColor3 = Colors.Card
  407. ExecConfirmBox.ZIndex = 91
  408. ExecConfirmBox.Parent = ExecConfirmOverlay
  409. Instance.new("UICorner", ExecConfirmBox).CornerRadius = UDim.new(0, 12)
  410. Instance.new("UIStroke", ExecConfirmBox).Color = Colors.Border
  411.  
  412. local ExecConfirmText = Instance.new("TextLabel")
  413. ExecConfirmText.Size = UDim2.new(1, -20, 0, 65)
  414. ExecConfirmText.Position = UDim2.new(0, 10, 0, 15)
  415. ExecConfirmText.BackgroundTransparency = 1
  416. ExecConfirmText.Text = "Do you want to execute this script?"
  417. ExecConfirmText.TextColor3 = Colors.Text
  418. ExecConfirmText.TextSize = 13
  419. ExecConfirmText.Font = Enum.Font.ArialBold
  420. ExecConfirmText.TextWrapped = true
  421. ExecConfirmText.ZIndex = 92
  422. ExecConfirmText.Parent = ExecConfirmBox
  423.  
  424. local ExecConfirmYes = Instance.new("TextButton")
  425. ExecConfirmYes.Size = UDim2.new(0, 110, 0, 32)
  426. ExecConfirmYes.Position = UDim2.new(0.5, -120, 1, -45)
  427. ExecConfirmYes.BackgroundColor3 = Colors.Green
  428. ExecConfirmYes.Text = "Yes"
  429. ExecConfirmYes.TextColor3 = Colors.Background
  430. ExecConfirmYes.Font = Enum.Font.GothamBold
  431. ExecConfirmYes.ZIndex = 92
  432. ExecConfirmYes.Parent = ExecConfirmBox
  433. Instance.new("UICorner", ExecConfirmYes).CornerRadius = UDim.new(1, 0)
  434.  
  435. local ExecConfirmCancel = Instance.new("TextButton")
  436. ExecConfirmCancel.Size = UDim2.new(0, 110, 0, 32)
  437. ExecConfirmCancel.Position = UDim2.new(0.5, 10, 1, -45)
  438. ExecConfirmCancel.BackgroundColor3 = Colors.Secondary
  439. ExecConfirmCancel.Text = "Cancel"
  440. ExecConfirmCancel.TextColor3 = Colors.Text
  441. ExecConfirmCancel.Font = Enum.Font.GothamBold
  442. ExecConfirmCancel.ZIndex = 92
  443. ExecConfirmCancel.Parent = ExecConfirmBox
  444. Instance.new("UICorner", ExecConfirmCancel).CornerRadius = UDim.new(1, 0)
  445.  
  446. local CurrentExecCallback = nil
  447. ExecConfirmYes.MouseButton1Click:Connect(function()
  448. ExecConfirmOverlay.Visible = false
  449. if CurrentExecCallback then CurrentExecCallback(true); CurrentExecCallback = nil end
  450. end)
  451. ExecConfirmCancel.MouseButton1Click:Connect(function()
  452. ExecConfirmOverlay.Visible = false
  453. if CurrentExecCallback then CurrentExecCallback(false); CurrentExecCallback = nil end
  454. end)
  455.  
  456. local function PromptExecute(scriptTitle, callback)
  457. local limitedTitle = scriptTitle
  458. if #limitedTitle > 40 then limitedTitle = limitedTitle:sub(1,37).."..." end
  459. ExecConfirmText.Text = 'Do you want to execute:\n"'..limitedTitle..'"?'
  460. CurrentExecCallback = callback
  461. ExecConfirmOverlay.Visible = true
  462. end
  463.  
  464. local CloseBtn = Instance.new("TextButton")
  465. CloseBtn.Size = UDim2.new(0, 24, 0, 24)
  466. CloseBtn.Position = UDim2.new(1, -32, 0.5, -12)
  467. CloseBtn.BackgroundColor3 = Colors.Red
  468. CloseBtn.Text = "ร—"
  469. CloseBtn.TextColor3 = Colors.Text
  470. CloseBtn.TextSize = 16
  471. CloseBtn.Font = Enum.Font.GothamBold
  472. CloseBtn.Parent = Header
  473. Instance.new("UICorner", CloseBtn).CornerRadius = UDim.new(1, 0)
  474. CloseBtn.MouseButton1Click:Connect(function() ConfirmOverlay.Visible = true end)
  475.  
  476. local MinBtn = Instance.new("TextButton")
  477. MinBtn.Size = UDim2.new(0, 24, 0, 24)
  478. MinBtn.Position = UDim2.new(1, -60, 0.5, -12)
  479. MinBtn.BackgroundColor3 = Colors.Yellow
  480. MinBtn.Text = "-"
  481. MinBtn.TextColor3 = Colors.Background
  482. MinBtn.TextSize = 18
  483. MinBtn.Font = Enum.Font.GothamBold
  484. MinBtn.Parent = Header
  485. Instance.new("UICorner", MinBtn).CornerRadius = UDim.new(1, 0)
  486. MinBtn.MouseButton1Click:Connect(function() MainFrame.Visible = false; ToggleBtn.Visible = true end)
  487.  
  488. local LockBtn = Instance.new("TextButton")
  489. LockBtn.Size = UDim2.new(0, 24, 0, 24)
  490. LockBtn.Position = UDim2.new(1, -88, 0.5, -12)
  491. LockBtn.BackgroundColor3 = Colors.Secondary
  492. LockBtn.Text = "๐Ÿ”“"
  493. LockBtn.TextColor3 = Colors.Text
  494. LockBtn.TextSize = 14
  495. LockBtn.Font = Enum.Font.Gotham
  496. LockBtn.Parent = Header
  497. Instance.new("UICorner", LockBtn).CornerRadius = UDim.new(1, 0)
  498. LockBtn.MouseButton1Click:Connect(function()
  499. isUIDraggable = not isUIDraggable
  500. LockBtn.Text = isUIDraggable and "๐Ÿ”“" or "๐Ÿ”’"
  501. end)
  502.  
  503. local TabBar = Instance.new("Frame")
  504. TabBar.Size = UDim2.new(1, 0, 0, 32)
  505. TabBar.Position = UDim2.new(0, 0, 0, 45)
  506. TabBar.BackgroundColor3 = Colors.Secondary
  507. TabBar.BackgroundTransparency = UITransparency
  508. TabBar.Parent = MainFrame
  509.  
  510. local TL = Instance.new("UIListLayout", TabBar)
  511. TL.FillDirection = Enum.FillDirection.Horizontal
  512. TL.Padding = UDim.new(0, 6)
  513. TL.VerticalAlignment = Enum.VerticalAlignment.Center
  514. Instance.new("UIPadding", TabBar).PaddingLeft = UDim.new(0, 8)
  515.  
  516. local function MakeTab(txt, col, par)
  517. local b = Instance.new("TextButton")
  518. b.Size = UDim2.new(0, #txt * 6 + 20, 0, 22)
  519. b.BackgroundColor3 = col; b.Text = txt; b.TextColor3 = Colors.Background
  520. b.TextSize = 10; b.Font = Enum.Font.GothamBold; b.Parent = par
  521. Instance.new("UICorner", b).CornerRadius = UDim.new(1, 0)
  522. return b
  523. end
  524.  
  525. local FreeTab = MakeTab("๐ŸŒ All", Colors.Green, TabBar)
  526. local ThisGameTab = MakeTab("๐ŸŽฎ This Game", Colors.Cyan, TabBar)
  527. local RefreshTab = MakeTab("๐Ÿ”„ Refresh", Colors.Orange, TabBar)
  528.  
  529. local StatusLabel = Instance.new("TextLabel")
  530. StatusLabel.Size = UDim2.new(0, 180, 0, 22)
  531. StatusLabel.BackgroundTransparency = 1
  532. StatusLabel.Text = ""
  533. StatusLabel.TextColor3 = Colors.SubText
  534. StatusLabel.TextSize = 9
  535. StatusLabel.Font = Enum.Font.Gotham
  536. StatusLabel.TextXAlignment = Enum.TextXAlignment.Left
  537. StatusLabel.Parent = TabBar
  538.  
  539. local GameInfoBar = Instance.new("Frame")
  540. GameInfoBar.Size = UDim2.new(1, 0, 0, 20)
  541. GameInfoBar.Position = UDim2.new(0, 0, 0, 77)
  542. GameInfoBar.BackgroundColor3 = Colors.Cyan
  543. GameInfoBar.BackgroundTransparency = 0.85
  544. GameInfoBar.Parent = MainFrame
  545.  
  546. local GameInfoLabel = Instance.new("TextLabel")
  547. GameInfoLabel.Size = UDim2.new(1, -16, 1, 0)
  548. GameInfoLabel.Position = UDim2.new(0, 8, 0, 0)
  549. GameInfoLabel.BackgroundTransparency = 1
  550. GameInfoLabel.Text = "๐ŸŽฎ Loading..."
  551. GameInfoLabel.TextColor3 = Colors.Cyan
  552. GameInfoLabel.TextSize = 9
  553. GameInfoLabel.Font = Enum.Font.GothamMedium
  554. GameInfoLabel.TextXAlignment = Enum.TextXAlignment.Left
  555. GameInfoLabel.TextTruncate = Enum.TextTruncate.AtEnd
  556. GameInfoLabel.Parent = GameInfoBar
  557.  
  558. local CopyIdBtn = Instance.new("TextButton")
  559. CopyIdBtn.Size = UDim2.new(0, 55, 0, 16)
  560. CopyIdBtn.Position = UDim2.new(1, -115, 0, 2)
  561. CopyIdBtn.BackgroundColor3 = Colors.Primary
  562. CopyIdBtn.BackgroundTransparency = 0.3
  563. CopyIdBtn.Text = "๐Ÿ“‹ ID"
  564. CopyIdBtn.TextColor3 = Colors.Text
  565. CopyIdBtn.TextSize = 8
  566. CopyIdBtn.Font = Enum.Font.GothamBold
  567. CopyIdBtn.Visible = false
  568. CopyIdBtn.Parent = GameInfoBar
  569. Instance.new("UICorner", CopyIdBtn).CornerRadius = UDim.new(1, 0)
  570.  
  571. local CopyNameBtn = Instance.new("TextButton")
  572. CopyNameBtn.Size = UDim2.new(0, 55, 0, 16)
  573. CopyNameBtn.Position = UDim2.new(1, -57, 0, 2)
  574. CopyNameBtn.BackgroundColor3 = Colors.Purple
  575. CopyNameBtn.BackgroundTransparency = 0.3
  576. CopyNameBtn.Text = "๐Ÿ“‹ Name"
  577. CopyNameBtn.TextColor3 = Colors.Text
  578. CopyNameBtn.TextSize = 8
  579. CopyNameBtn.Font = Enum.Font.GothamBold
  580. CopyNameBtn.Visible = false
  581. CopyNameBtn.Parent = GameInfoBar
  582. Instance.new("UICorner", CopyNameBtn).CornerRadius = UDim.new(1, 0)
  583.  
  584. task.spawn(function() CurrentGameId, CurrentGameName = GetCurrentGameInfo() end)
  585.  
  586. CopyIdBtn.MouseButton1Click:Connect(function() CopyToClipboard(tostring(CurrentGameId)); CopyIdBtn.Text = "โœ“ Done"; task.delay(1, function() CopyIdBtn.Text = "๐Ÿ“‹ ID" end) end)
  587. CopyNameBtn.MouseButton1Click:Connect(function() CopyToClipboard(CurrentGameName); CopyNameBtn.Text = "โœ“ Done"; task.delay(1, function() CopyNameBtn.Text = "๐Ÿ“‹ Name" end) end)
  588.  
  589. local function SetCopyVisible(v)
  590. CopyIdBtn.Visible = v; CopyNameBtn.Visible = v
  591. GameInfoLabel.Size = v and UDim2.new(1, -120, 1, 0) or UDim2.new(1, -16, 1, 0)
  592. end
  593.  
  594. local Containers = {}
  595. for _, tab in ipairs({"Free", "ThisGame", "Search"}) do
  596. local sf = Instance.new("ScrollingFrame")
  597. sf.Name = "Container_" .. tab
  598. sf.Size = UDim2.new(1, -16, 1, -105)
  599. sf.Position = UDim2.new(0, 8, 0, 100)
  600. sf.BackgroundTransparency = 1
  601. sf.ScrollBarThickness = 4
  602. sf.ScrollBarImageColor3 = Colors.Primary
  603. sf.CanvasSize = UDim2.new(0, 0, 0, 0)
  604. sf.Parent = MainFrame
  605. sf.Visible = false
  606.  
  607. local grid = Instance.new("UIGridLayout", sf)
  608. grid.CellSize = UDim2.new(0, 160, 0, 166)
  609. grid.CellPadding = UDim2.new(0, 6, 0, 6)
  610. grid.SortOrder = Enum.SortOrder.LayoutOrder
  611. Containers[tab] = sf
  612. end
  613.  
  614. local LoadingFrame = Instance.new("Frame")
  615. LoadingFrame.Size = UDim2.new(1, 0, 1, 0)
  616. LoadingFrame.BackgroundColor3 = Colors.Background
  617. LoadingFrame.BackgroundTransparency = 0.5
  618. LoadingFrame.Visible = false
  619. LoadingFrame.ZIndex = 50
  620. LoadingFrame.Parent = MainFrame
  621.  
  622. local LoadingText = Instance.new("TextLabel")
  623. LoadingText.Size = UDim2.new(1, 0, 1, 0)
  624. LoadingText.BackgroundTransparency = 1
  625. LoadingText.Text = "๐Ÿ”„ Loading..."
  626. LoadingText.TextColor3 = Colors.Primary
  627. LoadingText.TextSize = 16
  628. LoadingText.Font = Enum.Font.GothamBold
  629. LoadingText.ZIndex = 51
  630. LoadingText.Parent = LoadingFrame
  631.  
  632. local ModalOverlay = Instance.new("Frame")
  633. ModalOverlay.Size = UDim2.new(1, 0, 1, 0)
  634. ModalOverlay.BackgroundColor3 = Color3.new(0, 0, 0)
  635. ModalOverlay.BackgroundTransparency = 0.5
  636. ModalOverlay.Visible = false
  637. ModalOverlay.ZIndex = 60
  638. ModalOverlay.Parent = MainFrame
  639. ModalOverlay.Active = true
  640.  
  641. local Modal = Instance.new("Frame")
  642. Modal.Size = UDim2.new(0, 480, 0, 380)
  643. Modal.Position = UDim2.new(0.5, -240, 0.5, -190)
  644. Modal.BackgroundColor3 = Colors.Card
  645. Modal.BackgroundTransparency = UITransparency
  646. Modal.ZIndex = 61
  647. Modal.Parent = ModalOverlay
  648. Instance.new("UICorner", Modal).CornerRadius = UDim.new(0, 16)
  649. Instance.new("UIStroke", Modal).Color = Colors.Border
  650.  
  651. local MH = Instance.new("Frame")
  652. MH.Size = UDim2.new(1, 0, 0, 35)
  653. MH.BackgroundColor3 = Colors.Secondary
  654. MH.BackgroundTransparency = UITransparency
  655. MH.ZIndex = 62; MH.Parent = Modal
  656. Instance.new("UICorner", MH).CornerRadius = UDim.new(0, 16)
  657.  
  658. local MT = Instance.new("TextLabel")
  659. MT.Size = UDim2.new(1, -50, 1, 0)
  660. MT.Position = UDim2.new(0, 10, 0, 0)
  661. MT.BackgroundTransparency = 1
  662. MT.Text = "๐Ÿ“œ Script Viewer"
  663. MT.TextColor3 = Colors.Text
  664. MT.TextSize = 12
  665. MT.Font = Enum.Font.ArialBold
  666. MT.TextXAlignment = Enum.TextXAlignment.Left
  667. MT.TextTruncate = Enum.TextTruncate.AtEnd
  668. MT.ZIndex = 62; MT.Parent = MH
  669.  
  670. local MC = Instance.new("TextButton")
  671. MC.Size = UDim2.new(0, 25, 0, 25)
  672. MC.Position = UDim2.new(1, -30, 0.5, -12)
  673. MC.BackgroundColor3 = Colors.Red
  674. MC.Text = "ร—"; MC.TextColor3 = Colors.Text
  675. MC.TextSize = 14; MC.Font = Enum.Font.GothamBold
  676. MC.ZIndex = 63; MC.Parent = MH
  677. Instance.new("UICorner", MC).CornerRadius = UDim.new(1, 0)
  678. MC.MouseButton1Click:Connect(function() ModalOverlay.Visible = false end)
  679.  
  680. local ModalTabBar = Instance.new("Frame")
  681. ModalTabBar.Size = UDim2.new(1, 0, 0, 30)
  682. ModalTabBar.Position = UDim2.new(0, 0, 0, 35)
  683. ModalTabBar.BackgroundColor3 = Colors.Background
  684. ModalTabBar.BackgroundTransparency = UITransparency
  685. ModalTabBar.ZIndex = 62; ModalTabBar.Parent = Modal
  686.  
  687. local DescTabBtn = Instance.new("TextButton")
  688. DescTabBtn.Size = UDim2.new(0.33, 0, 1, 0)
  689. DescTabBtn.Position = UDim2.new(0, 0, 0, 0)
  690. DescTabBtn.BackgroundTransparency = 1
  691. DescTabBtn.Text = "๐Ÿ“ Description"
  692. DescTabBtn.TextColor3 = Colors.Primary
  693. DescTabBtn.Font = Enum.Font.GothamBold
  694. DescTabBtn.TextSize = 11
  695. DescTabBtn.ZIndex = 63; DescTabBtn.Parent = ModalTabBar
  696.  
  697. local CodeTabBtn = Instance.new("TextButton")
  698. CodeTabBtn.Size = UDim2.new(0.34, 0, 1, 0)
  699. CodeTabBtn.Position = UDim2.new(0.33, 0, 0, 0)
  700. CodeTabBtn.BackgroundTransparency = 1
  701. CodeTabBtn.Text = "๐Ÿ“œ View Raw"
  702. CodeTabBtn.TextColor3 = Colors.SubText
  703. CodeTabBtn.Font = Enum.Font.GothamBold
  704. CodeTabBtn.TextSize = 11
  705. CodeTabBtn.ZIndex = 63; CodeTabBtn.Parent = ModalTabBar
  706.  
  707. local CommentsTabBtn = Instance.new("TextButton")
  708. CommentsTabBtn.Size = UDim2.new(0.33, 0, 1, 0)
  709. CommentsTabBtn.Position = UDim2.new(0.67, 0, 0, 0)
  710. CommentsTabBtn.BackgroundTransparency = 1
  711. CommentsTabBtn.Text = "๐Ÿ’ฌ Comments (...)"
  712. CommentsTabBtn.TextColor3 = Colors.SubText
  713. CommentsTabBtn.Font = Enum.Font.GothamBold
  714. CommentsTabBtn.TextSize = 11
  715. CommentsTabBtn.ZIndex = 63; CommentsTabBtn.Parent = ModalTabBar
  716.  
  717. local MI = Instance.new("Frame")
  718. MI.Size = UDim2.new(1, -16, 0, 20)
  719. MI.Position = UDim2.new(0, 8, 0, 68)
  720. MI.BackgroundTransparency = 1; MI.ZIndex = 62; MI.Parent = Modal
  721.  
  722. local GB = Instance.new("TextLabel")
  723. GB.Size = UDim2.new(0, 120, 0, 16)
  724. GB.BackgroundColor3 = Colors.Primary; GB.BackgroundTransparency = 0.7
  725. GB.Text = "๐ŸŽฎ Game"; GB.TextColor3 = Colors.Primary
  726. GB.TextSize = 9
  727. GB.Font = Enum.Font.ArialBold
  728. GB.TextTruncate = Enum.TextTruncate.AtEnd; GB.ZIndex = 62; GB.Parent = MI
  729. Instance.new("UICorner", GB).CornerRadius = UDim.new(1, 0)
  730.  
  731. local SB = Instance.new("TextLabel")
  732. SB.Size = UDim2.new(0, 55, 0, 16)
  733. SB.Position = UDim2.new(0, 125, 0, 0)
  734. SB.BackgroundColor3 = Colors.Green
  735. SB.Text = "โœ“ Working"; SB.TextColor3 = Colors.Background
  736. SB.TextSize = 7; SB.Font = Enum.Font.GothamBold; SB.ZIndex = 62; SB.Parent = MI
  737. Instance.new("UICorner", SB).CornerRadius = UDim.new(1, 0)
  738.  
  739. local ML = Instance.new("TextLabel")
  740. ML.Size = UDim2.new(0, 120, 0, 16)
  741. ML.Position = UDim2.new(0, 185, 0, 0)
  742. ML.BackgroundTransparency = 1
  743. ML.Text = "โค๏ธ 0 | ๐Ÿ‘Ž 0"; ML.TextColor3 = Colors.SubText
  744. ML.TextSize = 9; ML.Font = Enum.Font.GothamMedium
  745. ML.TextXAlignment = Enum.TextXAlignment.Left; ML.ZIndex = 62; ML.Parent = MI
  746.  
  747. local DS = Instance.new("ScrollingFrame")
  748. DS.Size = UDim2.new(1, -16, 1, -135)
  749. DS.Position = UDim2.new(0, 8, 0, 95)
  750. DS.BackgroundColor3 = Colors.Background
  751. DS.BackgroundTransparency = UITransparency
  752. DS.ScrollBarThickness = 4; DS.ScrollBarImageColor3 = Colors.Primary
  753. DS.Visible = true
  754. DS.ZIndex = 62; DS.Parent = Modal
  755. Instance.new("UICorner", DS).CornerRadius = UDim.new(0, 12)
  756.  
  757. local dsLayout = Instance.new("UIListLayout", DS)
  758. dsLayout.SortOrder = Enum.SortOrder.LayoutOrder
  759. dsLayout.Padding = UDim.new(0, 4)
  760. local dsPad = Instance.new("UIPadding", DS)
  761. dsPad.PaddingTop = UDim.new(0, 8)
  762. dsPad.PaddingLeft = UDim.new(0, 8)
  763. dsPad.PaddingRight = UDim.new(0, 12)
  764.  
  765. dsLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  766. DS.CanvasSize = UDim2.new(0, 0, 0, dsLayout.AbsoluteContentSize.Y + 20)
  767. end)
  768.  
  769. local DescAuthor = Instance.new("TextLabel", DS)
  770. DescAuthor.Name = "DescAuthor"
  771. DescAuthor.Size = UDim2.new(1, 0, 0, 20)
  772. DescAuthor.BackgroundTransparency = 1
  773. DescAuthor.Text = "By: Loading..."
  774. DescAuthor.TextColor3 = Colors.Primary
  775. DescAuthor.TextSize = 12
  776. DescAuthor.Font = Enum.Font.ArialBold
  777. DescAuthor.TextXAlignment = Enum.TextXAlignment.Left
  778.  
  779. local SS = Instance.new("ScrollingFrame")
  780. SS.Size = UDim2.new(1, -16, 1, -135)
  781. SS.Position = UDim2.new(0, 8, 0, 95)
  782. SS.BackgroundColor3 = Colors.Background
  783. SS.BackgroundTransparency = UITransparency
  784. SS.ScrollBarThickness = 4; SS.ScrollBarImageColor3 = Colors.Primary
  785. SS.Visible = false
  786. SS.ZIndex = 62; SS.Parent = Modal
  787. Instance.new("UICorner", SS).CornerRadius = UDim.new(0, 12)
  788.  
  789. local ssLayout = Instance.new("UIListLayout", SS)
  790. ssLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
  791. SS.CanvasSize = UDim2.new(0, 0, 0, ssLayout.AbsoluteContentSize.Y + 20)
  792. end)
  793.  
  794. local SC = Instance.new("TextLabel")
  795. SC.Size = UDim2.new(1, -10, 0, 0)
  796. SC.Position = UDim2.new(0, 5, 0, 5)
  797. SC.BackgroundTransparency = 1; SC.Text = ""
  798. SC.TextColor3 = Colors.Green; SC.TextSize = 10; SC.Font = Enum.Font.Code
  799. SC.TextXAlignment = Enum.TextXAlignment.Left; SC.TextYAlignment = Enum.TextYAlignment.Top
  800. SC.TextWrapped = true
  801. SC.AutomaticSize = Enum.AutomaticSize.Y
  802. SC.ZIndex = 62; SC.Parent = SS
  803.  
  804. local CS = Instance.new("ScrollingFrame")
  805. CS.Size = UDim2.new(1, -16, 1, -100)
  806. CS.Position = UDim2.new(0, 8, 0, 95)
  807. CS.BackgroundColor3 = Colors.Background
  808. CS.BackgroundTransparency = UITransparency
  809. CS.ScrollBarThickness = 4; CS.ScrollBarImageColor3 = Colors.Primary
  810. CS.CanvasSize = UDim2.new(0, 0, 0, 0)
  811. CS.AutomaticCanvasSize = Enum.AutomaticSize.Y
  812. CS.Visible = false
  813. CS.ZIndex = 62; CS.Parent = Modal
  814. Instance.new("UICorner", CS).CornerRadius = UDim.new(0, 12)
  815.  
  816. local MBF = Instance.new("Frame")
  817. MBF.Size = UDim2.new(1, -16, 0, 35)
  818. MBF.Position = UDim2.new(0, 8, 1, -45)
  819. MBF.BackgroundTransparency = 1; MBF.ZIndex = 62; MBF.Parent = Modal
  820.  
  821. local CopyScriptBtn = Instance.new("TextButton")
  822. CopyScriptBtn.Size = UDim2.new(0.48, 0, 1, 0)
  823. CopyScriptBtn.Position = UDim2.new(0, 0, 0, 0)
  824. CopyScriptBtn.BackgroundColor3 = Colors.Secondary
  825. CopyScriptBtn.Text = "๐Ÿ“‹ Copy Script"
  826. CopyScriptBtn.TextColor3 = Colors.Text
  827. CopyScriptBtn.TextSize = 11
  828. CopyScriptBtn.Font = Enum.Font.GothamBold
  829. CopyScriptBtn.ZIndex = 63
  830. CopyScriptBtn.Parent = MBF
  831. Instance.new("UICorner", CopyScriptBtn).CornerRadius = UDim.new(1, 0)
  832.  
  833. local CopyUrlBtn = Instance.new("TextButton")
  834. CopyUrlBtn.Size = UDim2.new(0.48, 0, 1, 0)
  835. CopyUrlBtn.Position = UDim2.new(0.52, 0, 0, 0)
  836. CopyUrlBtn.BackgroundColor3 = Colors.Pink
  837. CopyUrlBtn.Text = "๐Ÿ”— Copy URL"
  838. CopyUrlBtn.TextColor3 = Colors.Background
  839. CopyUrlBtn.TextSize = 11
  840. CopyUrlBtn.Font = Enum.Font.GothamBold
  841. CopyUrlBtn.ZIndex = 63
  842. CopyUrlBtn.Parent = MBF
  843. Instance.new("UICorner", CopyUrlBtn).CornerRadius = UDim.new(1, 0)
  844.  
  845. CopyScriptBtn.MouseButton1Click:Connect(function() CopyToClipboard(currentScriptForView); CopyScriptBtn.Text = "โœ“ Copied!"; task.delay(1.5, function() CopyScriptBtn.Text = "๐Ÿ“‹ Copy Script" end) end)
  846. CopyUrlBtn.MouseButton1Click:Connect(function() if currentUrlForView and currentUrlForView ~= "" then CopyToClipboard(currentUrlForView); CopyUrlBtn.Text = "โœ“ URL Copied!"; task.delay(1.5, function() CopyUrlBtn.Text = "๐Ÿ”— Copy URL" end) end end)
  847.  
  848. local function SwitchModalTab(tabName)
  849. DescTabBtn.TextColor3 = (tabName == "Desc") and Colors.Primary or Colors.SubText
  850. CodeTabBtn.TextColor3 = (tabName == "Code") and Colors.Primary or Colors.SubText
  851. CommentsTabBtn.TextColor3 = (tabName == "Comments") and Colors.Primary or Colors.SubText
  852.  
  853. DS.Visible = (tabName == "Desc")
  854. SS.Visible = (tabName == "Code")
  855. CS.Visible = (tabName == "Comments")
  856.  
  857. MBF.Visible = (tabName ~= "Comments")
  858. end
  859.  
  860. DescTabBtn.MouseButton1Click:Connect(function() SwitchModalTab("Desc") end)
  861. CodeTabBtn.MouseButton1Click:Connect(function() SwitchModalTab("Code") end)
  862. CommentsTabBtn.MouseButton1Click:Connect(function() SwitchModalTab("Comments") end)
  863.  
  864. local function FetchScriptDetails(slug)
  865. DescAuthor.Text = "By: Loading..."
  866. for _, child in pairs(DS:GetChildren()) do
  867. if child:IsA("TextLabel") and child.Name == "DescLine" then child:Destroy() end
  868. end
  869.  
  870. local loadingLbl = Instance.new("TextLabel", DS)
  871. loadingLbl.Name = "DescLine"
  872. loadingLbl.Size = UDim2.new(1, 0, 0, 20)
  873. loadingLbl.BackgroundTransparency = 1
  874. loadingLbl.Text = "Loading full description..."
  875. loadingLbl.TextColor3 = Colors.Text
  876. loadingLbl.TextSize = 11
  877. loadingLbl.Font = Enum.Font.Arial
  878. loadingLbl.TextXAlignment = Enum.TextXAlignment.Left
  879.  
  880. task.spawn(function()
  881. local url = "https://scriptblox.com/api/script/" .. tostring(slug)
  882. local res = HttpRequest(url)
  883. if loadingLbl then loadingLbl:Destroy() end
  884.  
  885. if res and res.script then
  886. local scriptData = res.script
  887. local authorName = "Unknown"
  888.  
  889. if scriptData.owner and scriptData.owner.username then
  890. authorName = scriptData.owner.username
  891. elseif scriptData.user and scriptData.user.username then
  892. authorName = scriptData.user.username
  893. end
  894. DescAuthor.Text = "By: " .. authorName
  895.  
  896. local rawDesc = scriptData.features or scriptData.description or "No description provided."
  897. rawDesc = rawDesc:gsub("\r", "")
  898.  
  899. local lines = SplitString(rawDesc, "\n")
  900. for _, lineText in ipairs(lines) do
  901. local lineLbl = Instance.new("TextLabel", DS)
  902. lineLbl.Name = "DescLine"
  903. lineLbl.Size = UDim2.new(1, 0, 0, lineText == "" and 10 or 0)
  904. lineLbl.AutomaticSize = lineText == "" and Enum.AutomaticSize.None or Enum.AutomaticSize.Y
  905. lineLbl.BackgroundTransparency = 1
  906. lineLbl.Text = lineText
  907. lineLbl.TextColor3 = Colors.Text
  908. lineLbl.TextSize = 11
  909. lineLbl.Font = Enum.Font.Arial
  910. lineLbl.TextXAlignment = Enum.TextXAlignment.Left
  911. lineLbl.TextYAlignment = Enum.TextYAlignment.Top
  912. lineLbl.TextWrapped = true
  913. end
  914. end
  915. end)
  916. end
  917.  
  918. local function CreateCommentUI(comment, parent, isReply)
  919. local userObj = comment.commentBy or comment.replyBy or comment.user or comment.author or comment.by or {}
  920. local uName = userObj.username or userObj.name or "Unknown"
  921. local pPic = userObj.profilePicture or userObj.avatar or ""
  922. local txt = comment.text or comment.body or ""
  923. local tAgo = FormatTimeAgo(comment.createdAt)
  924.  
  925. local function countVotes(val)
  926. if type(val) == "number" then return val end
  927. if type(val) == "table" then return #val end
  928. return 0
  929. end
  930. local cLikes = comment.likeCount or countVotes(comment.likes) or countVotes(comment.upvotes) or 0
  931. local cDislikes = comment.dislikeCount or countVotes(comment.dislikes) or countVotes(comment.downvotes) or 0
  932.  
  933. txt = txt:gsub("<", "&lt;"):gsub(">", "&gt;")
  934. txt = txt:gsub("(@[%w_]+)", '<font color="#89b4fa">%1</font>')
  935.  
  936. local cFrame = Instance.new("Frame", parent)
  937. cFrame.Size = UDim2.new(1, 0, 0, 0)
  938. cFrame.BackgroundTransparency = 1
  939. cFrame.AutomaticSize = Enum.AutomaticSize.Y
  940.  
  941. local padding = Instance.new("UIPadding", cFrame)
  942. padding.PaddingLeft = UDim.new(0, isReply and 45 or 5)
  943.  
  944. local avatar = Instance.new("ImageLabel", cFrame)
  945. avatar.Size = UDim2.new(0, 30, 0, 30)
  946. avatar.Position = UDim2.new(0, 0, 0, 0)
  947. avatar.BackgroundTransparency = 1
  948. avatar.Image = "rbxassetid://10023616654"
  949. avatar.ScaleType = Enum.ScaleType.Crop
  950. Instance.new("UICorner", avatar).CornerRadius = UDim.new(1, 0)
  951.  
  952. task.spawn(function()
  953. if pPic ~= "" then
  954. local fullUrl = pPic:match("^http") and pPic or "https://scriptblox.com" .. (pPic:sub(1,1) == "/" and "" or "/") .. pPic
  955. local img = GetTempImageAsset(fullUrl)
  956. if img then pcall(function() avatar.Image = img end) end
  957. end
  958. end)
  959.  
  960. local contentBox = Instance.new("Frame", cFrame)
  961. contentBox.Size = UDim2.new(1, -40, 0, 0)
  962. contentBox.Position = UDim2.new(0, 40, 0, 0)
  963. contentBox.BackgroundTransparency = 1
  964. contentBox.AutomaticSize = Enum.AutomaticSize.Y
  965.  
  966. local cLayout = Instance.new("UIListLayout", contentBox)
  967. cLayout.SortOrder = Enum.SortOrder.LayoutOrder
  968. cLayout.Padding = UDim.new(0, 4)
  969.  
  970. local topRow = Instance.new("Frame", contentBox)
  971. topRow.Size = UDim2.new(1, 0, 0, 16)
  972. topRow.BackgroundTransparency = 1
  973.  
  974. local hLayout = Instance.new("UIListLayout", topRow)
  975. hLayout.FillDirection = Enum.FillDirection.Horizontal
  976. hLayout.VerticalAlignment = Enum.VerticalAlignment.Center
  977. hLayout.Padding = UDim.new(0, 6)
  978.  
  979. local userLbl = Instance.new("TextLabel", topRow)
  980. userLbl.AutomaticSize = Enum.AutomaticSize.XY
  981. userLbl.BackgroundTransparency = 1
  982. userLbl.Text = uName
  983. userLbl.TextColor3 = Colors.Text
  984. userLbl.Font = Enum.Font.ArialBold
  985. userLbl.TextSize = 11
  986.  
  987. local timeLbl = Instance.new("TextLabel", topRow)
  988. timeLbl.AutomaticSize = Enum.AutomaticSize.XY
  989. timeLbl.BackgroundTransparency = 1
  990. timeLbl.Text = tAgo
  991. timeLbl.TextColor3 = Colors.SubText
  992. timeLbl.Font = Enum.Font.Arial
  993. timeLbl.TextSize = 10
  994.  
  995. local bodyLbl = Instance.new("TextLabel", contentBox)
  996. bodyLbl.Size = UDim2.new(1, 0, 0, 0)
  997. bodyLbl.AutomaticSize = Enum.AutomaticSize.Y
  998. bodyLbl.BackgroundTransparency = 1
  999. bodyLbl.TextWrapped = true
  1000. bodyLbl.RichText = true
  1001. bodyLbl.TextColor3 = Colors.Text
  1002. bodyLbl.Font = Enum.Font.Arial
  1003. bodyLbl.TextSize = 11
  1004. bodyLbl.TextXAlignment = Enum.TextXAlignment.Left
  1005. bodyLbl.Text = txt
  1006.  
  1007. local actionRow = Instance.new("Frame", contentBox)
  1008. actionRow.Size = UDim2.new(1, 0, 0, 16)
  1009. actionRow.BackgroundTransparency = 1
  1010.  
  1011. local actLayout = Instance.new("UIListLayout", actionRow)
  1012. actLayout.FillDirection = Enum.FillDirection.Horizontal
  1013. actLayout.Padding = UDim.new(0, 15)
  1014.  
  1015. local function createAct(txtIcon)
  1016. local l = Instance.new("TextLabel", actionRow)
  1017. l.AutomaticSize = Enum.AutomaticSize.XY
  1018. l.BackgroundTransparency = 1
  1019. l.Text = txtIcon
  1020. l.TextColor3 = Colors.SubText
  1021. l.Font = Enum.Font.Arial
  1022. l.TextSize = 10
  1023. end
  1024.  
  1025. createAct("๐Ÿ‘ " .. FormatNumber(cLikes))
  1026. createAct("๐Ÿ‘Ž " .. FormatNumber(cDislikes))
  1027. end
  1028.  
  1029. local function FetchAndRenderComments(scriptId)
  1030. for _, c in pairs(CS:GetChildren()) do if c:IsA("Frame") or c:IsA("TextLabel") then c:Destroy() end end
  1031.  
  1032. local layout = CS:FindFirstChildOfClass("UIListLayout")
  1033. if not layout then
  1034. layout = Instance.new("UIListLayout", CS)
  1035. layout.SortOrder = Enum.SortOrder.LayoutOrder
  1036. layout.Padding = UDim.new(0, 15)
  1037. end
  1038.  
  1039. local loadingLbl = Instance.new("TextLabel", CS)
  1040. loadingLbl.Size = UDim2.new(1, 0, 0, 30)
  1041. loadingLbl.BackgroundTransparency = 1
  1042. loadingLbl.Text = "๐Ÿ”„ Fetching All Comments..."
  1043. loadingLbl.TextColor3 = Colors.Primary
  1044. loadingLbl.Font = Enum.Font.ArialBold
  1045. loadingLbl.TextSize = 11
  1046.  
  1047. task.spawn(function()
  1048. local allComments = {}
  1049. local fetchPage = 1
  1050. local maxPages = 1
  1051. local totalCommentsCount = 0
  1052.  
  1053. repeat
  1054. local url = "https://scriptblox.com/api/comment/" .. tostring(scriptId) .. "?page="..tostring(fetchPage).."&max=100"
  1055. local res = HttpRequest(url)
  1056. local fetchedComments = {}
  1057.  
  1058. if res then
  1059. local dataSource = res.result or res.data or res
  1060. if type(dataSource.comments) == "table" then fetchedComments = dataSource.comments end
  1061. maxPages = dataSource.totalPages or 1
  1062. totalCommentsCount = dataSource.total or totalCommentsCount
  1063. end
  1064.  
  1065. for _, c in ipairs(fetchedComments) do table.insert(allComments, c) end
  1066. if #fetchedComments == 0 then break end
  1067.  
  1068. fetchPage = fetchPage + 1
  1069. if fetchPage > 50 then break end
  1070. until fetchPage > maxPages
  1071.  
  1072. if loadingLbl then loadingLbl:Destroy() end
  1073. CommentsTabBtn.Text = string.format("๐Ÿ’ฌ Comments (%d)", totalCommentsCount > 0 and totalCommentsCount or #allComments)
  1074.  
  1075. if #allComments == 0 then
  1076. local noneLbl = Instance.new("TextLabel", CS)
  1077. noneLbl.Size = UDim2.new(1, 0, 0, 30)
  1078. noneLbl.BackgroundTransparency = 1
  1079. noneLbl.Text = "No comments yet."
  1080. noneLbl.TextColor3 = Colors.SubText
  1081. noneLbl.Font = Enum.Font.Arial
  1082. noneLbl.TextSize = 11
  1083. else
  1084. for _, c in ipairs(allComments) do
  1085. CreateCommentUI(c, CS, false)
  1086. if c.replies and type(c.replies) == "table" and #c.replies > 0 then
  1087. for _, r in ipairs(c.replies) do CreateCommentUI(r, CS, true) end
  1088. end
  1089. end
  1090. end
  1091. end)
  1092. end
  1093.  
  1094. local function UpdateUIState()
  1095. local state = TabData[CurrentTab]
  1096. for k, v in pairs(Containers) do v.Visible = (k == CurrentTab) end
  1097.  
  1098. if CurrentTab == "ThisGame" then
  1099. SetCopyVisible(true)
  1100. GameInfoLabel.Text = "๐ŸŽฎ " .. CurrentGameName .. " (ID: " .. CurrentGameId .. ")"
  1101. elseif CurrentTab == "Search" then
  1102. SetCopyVisible(false)
  1103. GameInfoLabel.Text = "๐Ÿ” Search Results"
  1104. else
  1105. SetCopyVisible(false)
  1106. GameInfoLabel.Text = "๐ŸŒ All Scripts"
  1107. end
  1108.  
  1109. if state.totalLoaded > 0 then StatusLabel.Text = string.format("๐Ÿ“Š %d scripts", state.totalLoaded)
  1110. elseif not state.isLoading then StatusLabel.Text = "โŒ No scripts found"
  1111. else StatusLabel.Text = "๐Ÿ”„ Loading..." end
  1112. end
  1113.  
  1114. local function CreateCard(data, index, tabName)
  1115. local state = TabData[tabName]
  1116. local id = data._id or data.slug or tostring(index)..tostring(tick())
  1117. if state.seen[id] then return false end
  1118. state.seen[id] = true
  1119. state.totalLoaded = state.totalLoaded + 1
  1120.  
  1121. local hasKey = data.key or data.keySystem or data.hasKey or false
  1122. local likes = data.likes or data.likeCount or 0
  1123. local dislikes = data.dislikes or data.dislikeCount or 0
  1124. local views = data.views or 0
  1125.  
  1126. local gid, gname = nil, "Universal"
  1127. if data.game then
  1128. gid = data.game.gameId or data.game.placeId or data.game.id
  1129. gname = data.game.name or "Unknown"
  1130. end
  1131.  
  1132. local ut = FormatTimeAgo(data.createdAt or data.updatedAt)
  1133. local isCur = gid and tonumber(gid) == tonumber(CurrentGameId)
  1134.  
  1135. local imgUrl = nil
  1136. if data.image and data.image ~= "" then
  1137. imgUrl = data.image:match("^http") and data.image or ("https://scriptblox.com" .. (data.image:sub(1,1) == "/" and "" or "/") .. data.image)
  1138. elseif data.game and data.game.imageUrl and data.game.imageUrl ~= "" then
  1139. imgUrl = data.game.imageUrl:match("^http") and data.game.imageUrl or ("https://scriptblox.com" .. (data.game.imageUrl:sub(1,1) == "/" and "" or "/") .. data.game.imageUrl)
  1140. end
  1141.  
  1142. local card = Instance.new("Frame")
  1143. card.Name = "C"..state.totalLoaded
  1144. card.BackgroundColor3 = Colors.Card
  1145. card.BackgroundTransparency = UITransparency
  1146. card.LayoutOrder = state.totalLoaded
  1147. card.Parent = Containers[tabName]
  1148. Instance.new("UICorner", card).CornerRadius = UDim.new(0, 12)
  1149. local cs = Instance.new("UIStroke", card)
  1150. cs.Color = isCur and Colors.Cyan or Colors.Border
  1151. cs.Transparency = UITransparency; cs.Thickness = isCur and 2 or 1
  1152.  
  1153. local ia = Instance.new("Frame")
  1154. ia.Size = UDim2.new(1, 0, 0, 75)
  1155. ia.BackgroundColor3 = Colors.Secondary
  1156. ia.ClipsDescendants = true; ia.Parent = card
  1157. Instance.new("UICorner", ia).CornerRadius = UDim.new(0, 12)
  1158.  
  1159. local gi = Instance.new("ImageLabel")
  1160. gi.Size = UDim2.new(1, 0, 1, 0); gi.BackgroundTransparency = 1
  1161. gi.ScaleType = Enum.ScaleType.Crop; gi.Parent = ia
  1162.  
  1163. local fb = Instance.new("TextLabel")
  1164. fb.Size = UDim2.new(1, 0, 1, 0); fb.BackgroundTransparency = 1
  1165. fb.Text = "๐ŸŽฎ"; fb.TextSize = 22; fb.Parent = ia
  1166.  
  1167. -- LOADS THE CUSTOM IMAGE OR FALLS BACK TO THE GAME ICON
  1168. task.spawn(function()
  1169. local loadedImg = false
  1170. if imgUrl then
  1171. local asset = GetTempImageAsset(imgUrl)
  1172. if asset then
  1173. pcall(function() gi.Image = asset; fb.Visible = false; loadedImg = true end)
  1174. end
  1175. end
  1176. if not loadedImg and gid then
  1177. pcall(function()
  1178. gi.Image = "rbxthumb://type=GameIcon&id="..tostring(gid).."&w=150&h=150"
  1179. task.wait(0.2)
  1180. if gi.IsLoaded or gi.Image ~= "" then fb.Visible = false end
  1181. end)
  1182. end
  1183. end)
  1184.  
  1185. local st = Instance.new("TextLabel")
  1186. st.Size = UDim2.new(0, 42, 0, 12); st.Position = UDim2.new(0, 3, 0, 3)
  1187. st.BackgroundColor3 = data.isPatched and Colors.Red or Colors.Green; st.BackgroundTransparency = 0.15
  1188. st.Text = data.isPatched and "Patched" or "Working"; st.TextColor3 = Colors.Text
  1189. st.TextSize = 7; st.Font = Enum.Font.GothamBold; st.ZIndex = 2; st.Parent = ia
  1190. Instance.new("UICorner", st).CornerRadius = UDim.new(1, 0)
  1191.  
  1192. local kb = Instance.new("TextLabel")
  1193. kb.Size = UDim2.new(0, 35, 0, 12); kb.Position = UDim2.new(1, -38, 0, 3)
  1194. kb.BackgroundColor3 = hasKey and Colors.Orange or Colors.Purple; kb.BackgroundTransparency = 0.15
  1195. kb.Text = hasKey and "๐Ÿ”‘Key" or "๐Ÿ”“Free"; kb.TextColor3 = Colors.Text
  1196. kb.TextSize = 6; kb.Font = Enum.Font.GothamBold; kb.ZIndex = 2; kb.Parent = ia
  1197. Instance.new("UICorner", kb).CornerRadius = UDim.new(1, 0)
  1198.  
  1199. if isCur and tabName == "ThisGame" then
  1200. local tb = Instance.new("TextLabel")
  1201. tb.Size = UDim2.new(0, 50, 0, 12); tb.Position = UDim2.new(0, 3, 1, -15)
  1202. tb.BackgroundColor3 = Colors.Cyan; tb.BackgroundTransparency = 0.15
  1203. tb.Text = "โœ“ Match"; tb.TextColor3 = Colors.Background
  1204. tb.TextSize = 7; tb.Font = Enum.Font.GothamBold; tb.ZIndex = 2; tb.Parent = ia
  1205. Instance.new("UICorner", tb).CornerRadius = UDim.new(1, 0)
  1206. end
  1207.  
  1208. local tl = Instance.new("TextLabel")
  1209. tl.Size = UDim2.new(1, -6, 0, 14); tl.Position = UDim2.new(0, 3, 0, 78)
  1210. tl.BackgroundTransparency = 1; tl.Text = data.title or "Unknown"
  1211. tl.TextColor3 = Colors.Text; tl.TextSize = 10
  1212. tl.Font = Enum.Font.ArialBold
  1213. tl.TextXAlignment = Enum.TextXAlignment.Left; tl.TextTruncate = Enum.TextTruncate.AtEnd; tl.Parent = card
  1214.  
  1215. local gl = Instance.new("TextLabel")
  1216. gl.Size = UDim2.new(1, -6, 0, 11); gl.Position = UDim2.new(0, 3, 0, 92)
  1217. gl.BackgroundTransparency = 1; gl.Text = "๐ŸŽฎ "..gname
  1218. gl.TextColor3 = isCur and Colors.Cyan or Colors.SubText
  1219. gl.TextSize = 8
  1220. gl.Font = Enum.Font.Arial
  1221. gl.TextXAlignment = Enum.TextXAlignment.Left; gl.TextTruncate = Enum.TextTruncate.AtEnd; gl.Parent = card
  1222.  
  1223. local sr = Instance.new("Frame")
  1224. sr.Size = UDim2.new(1, -6, 0, 14); sr.Position = UDim2.new(0, 3, 0, 104)
  1225. sr.BackgroundTransparency = 1; sr.Parent = card
  1226.  
  1227. local lt = Instance.new("TextLabel")
  1228. lt.Size = UDim2.new(1, 0, 1, 0); lt.BackgroundTransparency = 1
  1229. lt.Text = string.format("โค๏ธ%s ๐Ÿ‘Ž%s ๐Ÿ‘%s", FormatNumber(likes), FormatNumber(dislikes), FormatNumber(views))
  1230. lt.TextColor3 = Colors.SubText; lt.TextSize = 8
  1231. lt.Font = Enum.Font.Arial
  1232. lt.TextXAlignment = Enum.TextXAlignment.Left; lt.Parent = sr
  1233.  
  1234. local tml = Instance.new("TextLabel")
  1235. tml.Size = UDim2.new(1, -6, 0, 12); tml.Position = UDim2.new(0, 3, 0, 122)
  1236. tml.BackgroundTransparency = 1; tml.Text = "๐Ÿ• "..ut
  1237. tml.TextColor3 = Colors.Teal; tml.TextSize = 8
  1238. tml.Font = Enum.Font.Arial
  1239. tml.TextXAlignment = Enum.TextXAlignment.Left; tml.Parent = card
  1240.  
  1241. local vb = Instance.new("TextButton")
  1242. vb.Size = UDim2.new(0.48, -2, 0, 20); vb.Position = UDim2.new(0, 3, 0, 141)
  1243. vb.BackgroundColor3 = Colors.Secondary; vb.Text = "๐Ÿ‘ View"; vb.TextColor3 = Colors.Text
  1244. vb.TextSize = 9; vb.Font = Enum.Font.GothamMedium; vb.Parent = card
  1245. Instance.new("UICorner", vb).CornerRadius = UDim.new(1, 0)
  1246.  
  1247. local rb = Instance.new("TextButton")
  1248. rb.Size = UDim2.new(0.48, -2, 0, 20); rb.Position = UDim2.new(0.5, 1, 0, 141)
  1249. rb.BackgroundColor3 = hasKey and Colors.Orange or Colors.Primary
  1250. rb.Text = hasKey and "๐Ÿ”‘ Execute" or "โ–ถ Execute"; rb.TextColor3 = Colors.Background
  1251. rb.TextSize = 9; rb.Font = Enum.Font.GothamBold; rb.Parent = card
  1252. Instance.new("UICorner", rb).CornerRadius = UDim.new(1, 0)
  1253.  
  1254. card.MouseEnter:Connect(function() TweenService:Create(cs, TweenInfo.new(0.15), {Color = Colors.Primary}):Play() end)
  1255. card.MouseLeave:Connect(function() TweenService:Create(cs, TweenInfo.new(0.15), {Color = isCur and Colors.Cyan or Colors.Border}):Play() end)
  1256.  
  1257. vb.MouseButton1Click:Connect(function()
  1258. currentScriptForView = data.script or "-- No script provided"
  1259. currentUrlForView = GetScriptUrl(data)
  1260.  
  1261. MT.Text = "๐Ÿ“œ "..(data.title or "Script")
  1262. GB.Text = "๐ŸŽฎ "..gname
  1263. SB.Text = data.isPatched and "โœ• Patched" or "โœ“ Working"
  1264. SB.BackgroundColor3 = data.isPatched and Colors.Red or Colors.Green
  1265.  
  1266. ML.Text = string.format("โค๏ธ %s | ๐Ÿ‘Ž %s", FormatNumber(likes), FormatNumber(dislikes))
  1267. SC.Text = currentScriptForView
  1268.  
  1269. CommentsTabBtn.Text = "๐Ÿ’ฌ Comments (...)"
  1270. SwitchModalTab("Desc")
  1271. ModalOverlay.Visible = true
  1272.  
  1273. if data.slug then FetchScriptDetails(data.slug) end
  1274. if data._id then FetchAndRenderComments(data._id) end
  1275. end)
  1276.  
  1277. rb.MouseButton1Click:Connect(function()
  1278. local s = data.script or ""
  1279. if s ~= "" then
  1280. PromptExecute(data.title or "Script", function(confirmed)
  1281. if confirmed then
  1282. rb.Text = "โณ..."
  1283. task.spawn(function()
  1284. local ok = pcall(function() loadstring(s)() end)
  1285. rb.Text = ok and "โœ“ Executed" or "โœ• Error"
  1286. task.delay(1, function() rb.Text = hasKey and "๐Ÿ”‘ Execute" or "โ–ถ Execute" end)
  1287. end)
  1288. end
  1289. end)
  1290. end
  1291. end)
  1292. return true
  1293. end
  1294.  
  1295. local function LoadPage(tabName)
  1296. local state = TabData[tabName]
  1297. if state.isLoading or not state.hasMore then return end
  1298.  
  1299. state.isLoading = true
  1300. if CurrentTab == tabName then LoadingFrame.Visible = true end
  1301.  
  1302. task.spawn(function()
  1303. local url
  1304. if state.query and state.query ~= "" then url = string.format("https://scriptblox.com/api/script/search?q=%s&page=%d&max=%d", HttpService:UrlEncode(state.query), state.page, maxPerPage)
  1305. else url = string.format("https://scriptblox.com/api/script/fetch?page=%d&max=%d", state.page, maxPerPage) end
  1306.  
  1307. local result = HttpRequest(url)
  1308. if CurrentTab == tabName then LoadingFrame.Visible = false end
  1309.  
  1310. if result and result.result then
  1311. local scripts = result.result.scripts or {}
  1312. local totalPages = result.result.totalPages or 1
  1313. state.totalApi = result.result.total or state.totalApi
  1314.  
  1315. if #scripts > 0 then
  1316. for _, d in ipairs(scripts) do CreateCard(d, state.totalLoaded + 1, tabName) end
  1317. state.page = state.page + 1
  1318. state.hasMore = state.page <= totalPages
  1319. else state.hasMore = false end
  1320. else state.hasMore = false end
  1321.  
  1322. state.isLoading = false
  1323. if CurrentTab == tabName then UpdateUIState(); task.defer(function()
  1324. if Containers[tabName] then
  1325. local grid = Containers[tabName]:FindFirstChildOfClass("UIGridLayout")
  1326. if grid then Containers[tabName].CanvasSize = UDim2.new(0, 0, 0, grid.AbsoluteContentSize.Y + 20) end
  1327. end
  1328. end) end
  1329. end)
  1330. end
  1331.  
  1332. local function ClearContent(tabName)
  1333. if Containers[tabName] then
  1334. for _, c in pairs(Containers[tabName]:GetChildren()) do if c:IsA("Frame") then c:Destroy() end end
  1335. Containers[tabName].CanvasPosition = Vector2.new(0, 0)
  1336. end
  1337. end
  1338.  
  1339. local function TriggerSearch(queryText)
  1340. CurrentTab = "Search"
  1341. TabData.Search = { page = 1, hasMore = true, isLoading = false, totalLoaded = 0, totalApi = 0, query = queryText, seen = {} }
  1342. ClearContent("Search"); UpdateUIState(); LoadPage("Search")
  1343. end
  1344.  
  1345. local function SwitchToFree()
  1346. CurrentTab = "Free"; UpdateUIState()
  1347. if TabData.Free.totalLoaded == 0 then LoadPage("Free") end
  1348. end
  1349.  
  1350. local function SwitchToThisGame()
  1351. CurrentTab = "ThisGame"; UpdateUIState()
  1352. if TabData.ThisGame.totalLoaded == 0 then
  1353. local cleanName = CurrentGameName:gsub("%[.-%]", ""):gsub("%(.-%)", ""):gsub("ใ€.-ใ€‘", ""):match("^%s*(.-)%s*$")
  1354. if not cleanName or cleanName == "" then cleanName = CurrentGameName end
  1355. TabData.ThisGame.query = cleanName; LoadPage("ThisGame")
  1356. end
  1357. end
  1358.  
  1359. local function RefreshCurrentTab()
  1360. local tab = CurrentTab; local q = TabData[tab].query
  1361. ClearContent(tab)
  1362. TabData[tab] = { page = 1, hasMore = true, isLoading = false, totalLoaded = 0, totalApi = 0, query = q, seen = {} }
  1363. UpdateUIState(); LoadPage(tab)
  1364. end
  1365.  
  1366. task.spawn(function()
  1367. while ScreenGui.Parent do
  1368. task.wait(0.25)
  1369. if not MainFrame.Visible or ModalOverlay.Visible or ConfirmOverlay.Visible or ExecConfirmOverlay.Visible then continue end
  1370. local activeContainer = Containers[CurrentTab]
  1371. local state = TabData[CurrentTab]
  1372. if not activeContainer or state.isLoading or not state.hasMore then continue end
  1373. local scrollPos = activeContainer.CanvasPosition.Y
  1374. local canvasH = activeContainer.CanvasSize.Y.Offset
  1375. local frameH = activeContainer.AbsoluteSize.Y
  1376. if canvasH <= frameH + 50 or (canvasH - scrollPos - frameH < 400) then LoadPage(CurrentTab) end
  1377. end
  1378. end)
  1379.  
  1380. for _, sf in pairs(Containers) do
  1381. sf:GetPropertyChangedSignal("CanvasPosition"):Connect(function()
  1382. if sf.Visible then
  1383. local state = TabData[CurrentTab]
  1384. if state.isLoading or not state.hasMore then return end
  1385. if sf.CanvasSize.Y.Offset - sf.CanvasPosition.Y - sf.AbsoluteSize.Y < 300 then task.defer(function() LoadPage(CurrentTab) end) end
  1386. end
  1387. end)
  1388. end
  1389.  
  1390. SearchBtn.MouseButton1Click:Connect(function() local t = SearchBox.Text; if t and t ~= "" then TriggerSearch(t) end end)
  1391. SearchBox.FocusLost:Connect(function(e) if e then local t = SearchBox.Text; if t and t ~= "" then TriggerSearch(t) end end end)
  1392. FreeTab.MouseButton1Click:Connect(function() SwitchToFree() end)
  1393. ThisGameTab.MouseButton1Click:Connect(function() SwitchToThisGame() end)
  1394. RefreshTab.MouseButton1Click:Connect(function() RefreshCurrentTab() end)
  1395.  
  1396. task.spawn(function() SwitchToFree() end)
Advertisement
Add Comment
Please, Sign In to add comment