MaxproGlitcher

Bot Musique VC

Dec 13th, 2025
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.13 KB | None | 0 0
  1. if not game:GetService("GuiService") then
  2. print("Error: Not running in Roblox environment")
  3. return
  4. end
  5.  
  6. local UserInputService = game:GetService("UserInputService")
  7. local Players = game:GetService("Players")
  8. local player = Players.LocalPlayer
  9. local playerGui = player:WaitForChild("PlayerGui")
  10.  
  11. local screenGui = Instance.new("ScreenGui")
  12. screenGui.Name = "SpotifyMusicBot"
  13. screenGui.ResetOnSpawn = false
  14. screenGui.Parent = playerGui
  15.  
  16. local mainFrame = Instance.new("Frame")
  17. mainFrame.Name = "MainFrame"
  18. mainFrame.Size = UDim2.new(0, 500, 0, 350)
  19. mainFrame.Position = UDim2.new(0.5, -250, 0.5, -175)
  20. mainFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
  21. mainFrame.BorderSizePixel = 0
  22. mainFrame.Parent = screenGui
  23.  
  24. mainFrame.Size = UDim2.new(0, 500, 0, 350)
  25. mainFrame.Position = UDim2.new(0.5, -250, 0.5, -175)
  26. mainFrame.BackgroundColor3 = Color3.fromRGB(26, 26, 26)
  27. mainFrame.BorderSizePixel = 0
  28. local mainCorner = Instance.new("UICorner", mainFrame)
  29. mainCorner.CornerRadius = UDim.new(0, 12)
  30. local mainStroke = Instance.new("UIStroke", mainFrame)
  31. mainStroke.Color = Color3.fromRGB(45, 45, 45)
  32. mainStroke.Transparency = 0.7
  33. mainStroke.Thickness = 1
  34.  
  35. local mainGrad = Instance.new("UIGradient", mainFrame)
  36. mainGrad.Color = ColorSequence.new{
  37. ColorSequenceKeypoint.new(0, Color3.fromRGB(28,28,28)),
  38. ColorSequenceKeypoint.new(1, Color3.fromRGB(22,22,22))
  39. }
  40. mainGrad.Rotation = 90
  41.  
  42. local header = Instance.new("Frame")
  43. header.Name = "Header"
  44. header.Size = UDim2.new(1, 0, 0, 42)
  45. header.Position = UDim2.new(0, 0, 0, 0)
  46. header.BackgroundTransparency = 0
  47. header.BackgroundColor3 = Color3.fromRGB(36, 143, 86)
  48. header.BorderSizePixel = 0
  49. header.Parent = mainFrame
  50. local headerCorner = Instance.new("UICorner", header)
  51. headerCorner.CornerRadius = UDim.new(0, 12)
  52. local headerLabel = Instance.new("TextLabel", header)
  53. headerLabel.Size = UDim2.new(1, 0, 1, 0)
  54. headerLabel.BackgroundTransparency = 1
  55. headerLabel.Text = "đŸŽĩ Spotify Music Bot"
  56. headerLabel.TextColor3 = Color3.fromRGB(245,245,245)
  57. headerLabel.Font = Enum.Font.GothamBold
  58. headerLabel.TextSize = 18
  59. headerLabel.TextXAlignment = Enum.TextXAlignment.Center
  60. headerLabel.TextYAlignment = Enum.TextYAlignment.Center
  61.  
  62. local inputLabel = Instance.new("TextLabel")
  63. inputLabel.Name = "InputLabel"
  64. inputLabel.Size = UDim2.new(1, -20, 0, 20)
  65. inputLabel.Position = UDim2.new(0, 10, 0, 62)
  66. inputLabel.BackgroundTransparency = 1
  67. inputLabel.Text = "Enter Spotify Link:"
  68. inputLabel.TextColor3 = Color3.fromRGB(200, 200, 200)
  69. inputLabel.TextSize = 14
  70. inputLabel.TextXAlignment = Enum.TextXAlignment.Left
  71. inputLabel.Font = Enum.Font.Gotham
  72. inputLabel.Parent = mainFrame
  73.  
  74. local inputBox = Instance.new("TextBox")
  75. inputBox.Name = "InputBox"
  76. inputBox.Size = UDim2.new(1, -20, 0, 30)
  77. inputBox.Position = UDim2.new(0, 10, 0, 87)
  78. inputBox.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
  79. inputBox.TextColor3 = Color3.fromRGB(255, 255, 255)
  80. inputBox.Text = ""
  81. inputBox.PlaceholderText = "https://open.spotify.com/track/..."
  82. inputBox.TextSize = 12
  83. inputBox.Font = Enum.Font.Gotham
  84. inputBox.BorderSizePixel = 1
  85. inputBox.BorderColor3 = Color3.fromRGB(100, 100, 100)
  86. inputBox.Parent = mainFrame
  87.  
  88. local loadButton = Instance.new("TextButton")
  89. loadButton.Name = "LoadButton"
  90. loadButton.Size = UDim2.new(1, -20, 0, 35)
  91. loadButton.Position = UDim2.new(0, 10, 0, 127)
  92. loadButton.BackgroundColor3 = Color3.fromRGB(29, 185, 84)
  93. loadButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  94. loadButton.Text = "Load Song"
  95. loadButton.TextSize = 14
  96. loadButton.Font = Enum.Font.GothamBold
  97. loadButton.BorderSizePixel = 0
  98. loadButton.Parent = mainFrame
  99.  
  100. local infoFrame = Instance.new("Frame")
  101. infoFrame.Name = "InfoFrame"
  102. infoFrame.Size = UDim2.new(1, -20, 0, 120)
  103. infoFrame.Position = UDim2.new(0, 10, 0, 177)
  104. infoFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  105. infoFrame.BorderSizePixel = 1
  106. infoFrame.BorderColor3 = Color3.fromRGB(100, 100, 100)
  107. infoFrame.Parent = mainFrame
  108.  
  109. local songImage = Instance.new("ImageLabel")
  110. songImage.Name = "SongImage"
  111. songImage.Size = UDim2.new(0, 84, 0, 84)
  112. songImage.Position = UDim2.new(0, 8, 0, 8)
  113. songImage.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  114. songImage.BorderSizePixel = 0
  115. local imageCorner = Instance.new("UICorner", songImage)
  116. imageCorner.CornerRadius = UDim.new(0, 8)
  117. local imageStroke = Instance.new("UIStroke", songImage)
  118. imageStroke.Color = Color3.fromRGB(60,60,60)
  119. imageStroke.Transparency = 0.6
  120.  
  121. songImage.Parent = infoFrame
  122.  
  123. local songTitle = Instance.new("TextLabel")
  124. songTitle.Name = "SongTitle"
  125. songTitle.Size = UDim2.new(1, -110, 0, 40)
  126. songTitle.Position = UDim2.new(0, 100, 0, 10)
  127. songTitle.BackgroundTransparency = 1
  128. songTitle.Text = "No song loaded"
  129. songTitle.TextColor3 = Color3.fromRGB(255, 255, 255)
  130. songTitle.TextSize = 14
  131. songTitle.Font = Enum.Font.GothamSemibold
  132. songTitle.TextXAlignment = Enum.TextXAlignment.Left
  133. songTitle.TextWrapped = true
  134. songTitle.Parent = infoFrame
  135.  
  136. local songArtist = Instance.new("TextLabel")
  137. songArtist.Name = "SongArtist"
  138. songArtist.Size = UDim2.new(1, -110, 0, 40)
  139. songArtist.Position = UDim2.new(0, 100, 0, 50)
  140. songArtist.BackgroundTransparency = 1
  141. songArtist.Text = "Artist unknown"
  142. songArtist.TextColor3 = Color3.fromRGB(150, 150, 150)
  143. songArtist.TextSize = 12
  144. songArtist.Font = Enum.Font.Gotham
  145. songArtist.TextXAlignment = Enum.TextXAlignment.Left
  146. songArtist.TextWrapped = true
  147. songArtist.Parent = infoFrame
  148.  
  149. local playButton = Instance.new("TextButton")
  150. playButton.Name = "PlayButton"
  151. playButton.Size = UDim2.new(0.6, -10, 0, 35)
  152. playButton.Position = UDim2.new(0, 10, 0, 310)
  153. playButton.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
  154. playButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  155. playButton.Text = "â–ļ Play"
  156. playButton.TextSize = 14
  157. playButton.Font = Enum.Font.GothamBold
  158. playButton.BorderSizePixel = 0
  159. playButton.Parent = mainFrame
  160. playButton.Visible = false
  161.  
  162. local pauseButton = Instance.new("TextButton")
  163. pauseButton.Name = "PauseButton"
  164. pauseButton.Size = UDim2.new(0.2, -5, 0, 35)
  165. pauseButton.Position = UDim2.new(0.6, 0, 0, 310)
  166. pauseButton.BackgroundColor3 = Color3.fromRGB(180, 180, 60)
  167. pauseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  168. pauseButton.Text = "⏸ Pause"
  169. pauseButton.TextSize = 14
  170. pauseButton.Font = Enum.Font.GothamBold
  171. pauseButton.BorderSizePixel = 0
  172. pauseButton.Parent = mainFrame
  173. pauseButton.Visible = false
  174.  
  175. local stopButton = Instance.new("TextButton")
  176. stopButton.Name = "StopButton"
  177. stopButton.Size = UDim2.new(0.2, -5, 0, 35)
  178. stopButton.Position = UDim2.new(0.8, 0, 0, 310)
  179. stopButton.BackgroundColor3 = Color3.fromRGB(200, 80, 80)
  180. stopButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  181. stopButton.Text = "⏚ Stop"
  182. stopButton.TextSize = 14
  183. stopButton.Font = Enum.Font.GothamBold
  184. stopButton.BorderSizePixel = 0
  185. stopButton.Parent = mainFrame
  186. stopButton.Visible = false
  187.  
  188. local statusLabel = Instance.new("TextLabel")
  189. statusLabel.Name = "Status"
  190. statusLabel.Size = UDim2.new(1, 0, 0, 20)
  191. statusLabel.Position = UDim2.new(0, 0, 1, -20)
  192. statusLabel.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  193. statusLabel.TextColor3 = Color3.fromRGB(100, 200, 100)
  194. statusLabel.Text = "Ready"
  195. statusLabel.TextSize = 10
  196. statusLabel.Font = Enum.Font.Gotham
  197. statusLabel.BorderSizePixel = 0
  198. statusLabel.Parent = mainFrame
  199.  
  200. local currentSongData = nil
  201. local pythonRunning = false
  202. local PYTHON_SERVER = "http://localhost:5000"
  203. local songQueue = {}
  204. local isPlaying = false
  205. local isPaused = false
  206. local playbackThread = nil
  207.  
  208. local PLACEHOLDER_IMAGE = "rbxassetid://7072716801"
  209.  
  210. local function setRemoteImage(imgLabel, url)
  211. if not url or url == "" then
  212. pcall(function() imgLabel.Image = PLACEHOLDER_IMAGE end)
  213. return
  214. end
  215.  
  216. local ok, res = pcall(function()
  217. return game:HttpGet(url, true)
  218. end)
  219.  
  220. if ok and res and #res > 0 then
  221. pcall(function() imgLabel.Image = url end)
  222. else
  223. pcall(function() imgLabel.Image = PLACEHOLDER_IMAGE end)
  224. end
  225. end
  226.  
  227. local WHITELIST = {
  228. "lolwhenme"
  229. }
  230.  
  231. local function isPlayerWhitelisted(playerName)
  232. for _, whitelistedName in ipairs(WHITELIST) do
  233. if whitelistedName:lower() == playerName:lower() then
  234. return true
  235. end
  236. end
  237. return false
  238. end
  239.  
  240. local dragging = false
  241. local dragStart = nil
  242. local frameStart = nil
  243.  
  244. mainFrame.InputBegan:Connect(function(input, gameProcessed)
  245. if gameProcessed then return end
  246. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  247. dragging = true
  248. dragStart = input.Position
  249. frameStart = mainFrame.Position
  250. end
  251. end)
  252.  
  253. mainFrame.InputEnded:Connect(function(input, gameProcessed)
  254. if input.UserInputType == Enum.UserInputType.MouseButton1 then
  255. dragging = false
  256. end
  257. end)
  258.  
  259. UserInputService.InputChanged:Connect(function(input, gameProcessed)
  260. if dragging and input.UserInputType == Enum.UserInputType.MouseMovement then
  261. local delta = input.Position - dragStart
  262. mainFrame.Position = frameStart + UDim2.new(0, delta.X, 0, delta.Y)
  263. end
  264. end)
  265.  
  266. local queueFrame = Instance.new("Frame")
  267. queueFrame.Name = "QueueFrame"
  268. queueFrame.Size = UDim2.new(0, 320, 0, 260)
  269. queueFrame.Position = UDim2.new(0.5, 260, 0.5, -175)
  270. queueFrame.BackgroundColor3 = Color3.fromRGB(28,28,28)
  271. queueFrame.BorderSizePixel = 0
  272. queueFrame.Parent = screenGui
  273. queueFrame.Visible = false
  274.  
  275. local queueTitle = Instance.new("TextLabel")
  276. queueTitle.Name = "QueueTitle"
  277. queueTitle.Size = UDim2.new(1, 0, 0, 36)
  278. queueTitle.Font = Enum.Font.GothamBold
  279. queueTitle.TextSize = 14
  280. queueTitle.BackgroundColor3 = Color3.fromRGB(40,150,90)
  281. queueTitle.TextColor3 = Color3.fromRGB(255,255,255)
  282. queueTitle.BorderSizePixel = 0
  283. queueTitle.Parent = queueFrame
  284.  
  285. local queueList = Instance.new("ScrollingFrame")
  286. queueList.Name = "QueueList"
  287. queueList.Size = UDim2.new(1, 0, 1, -30)
  288. queueList.Position = UDim2.new(0, 0, 0, 30)
  289. queueList.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  290. queueList.BorderSizePixel = 0
  291. queueList.ScrollBarThickness = 5
  292. queueList.CanvasSize = UDim2.new(0, 0, 0, 0)
  293. queueList.Parent = queueFrame
  294.  
  295. local UIListLayout = Instance.new("UIListLayout")
  296. UIListLayout.Padding = UDim.new(0, 5)
  297. UIListLayout.Parent = queueList
  298.  
  299. local queueButton = Instance.new("TextButton")
  300. queueButton.Name = "QueueButton"
  301. queueButton.Size = UDim2.new(0.3, -5, 0, 30)
  302. queueButton.Position = UDim2.new(0.7, 0, 0, 125)
  303. queueButton.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
  304. queueButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  305. queueButton.Text = "📋 Queue"
  306. queueButton.TextSize = 12
  307. queueButton.Font = Enum.Font.GothamBold
  308. queueButton.BorderSizePixel = 0
  309. queueButton.Parent = mainFrame
  310.  
  311. -- Credits Button
  312. local creditsButton = Instance.new("TextButton")
  313. creditsButton.Name = "CreditsButton"
  314. creditsButton.Size = UDim2.new(0, 32, 0, 32)
  315. creditsButton.Position = UDim2.new(1, -42, 0, 5)
  316. creditsButton.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
  317. creditsButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  318. creditsButton.Text = "â„šī¸"
  319. creditsButton.TextSize = 16
  320. creditsButton.Font = Enum.Font.GothamBold
  321. creditsButton.BorderSizePixel = 0
  322. creditsButton.Parent = header
  323. local creditsCorner = Instance.new("UICorner", creditsButton)
  324. creditsCorner.CornerRadius = UDim.new(0, 6)
  325.  
  326. -- Credits Modal
  327. local creditsModal = Instance.new("Frame")
  328. creditsModal.Name = "CreditsModal"
  329. creditsModal.Size = UDim2.new(0, 320, 0, 220)
  330. creditsModal.Position = UDim2.new(0.5, -160, 0.5, -110)
  331. creditsModal.BackgroundColor3 = Color3.fromRGB(26, 26, 26)
  332. creditsModal.BorderSizePixel = 0
  333. creditsModal.Parent = screenGui
  334. creditsModal.Visible = false
  335. creditsModal.ZIndex = 100
  336.  
  337. local creditsCornerBg = Instance.new("UICorner", creditsModal)
  338. creditsCornerBg.CornerRadius = UDim.new(0, 12)
  339. local creditsStrokeBg = Instance.new("UIStroke", creditsModal)
  340. creditsStrokeBg.Color = Color3.fromRGB(45, 45, 45)
  341. creditsStrokeBg.Transparency = 0.7
  342. creditsStrokeBg.Thickness = 1
  343.  
  344. local creditsHeader = Instance.new("Frame", creditsModal)
  345. creditsHeader.Name = "Header"
  346. creditsHeader.Size = UDim2.new(1, 0, 0, 40)
  347. creditsHeader.BackgroundColor3 = Color3.fromRGB(36, 143, 86)
  348. creditsHeader.BorderSizePixel = 0
  349. local creditsHeaderCorner = Instance.new("UICorner", creditsHeader)
  350. creditsHeaderCorner.CornerRadius = UDim.new(0, 12)
  351.  
  352. local creditsHeaderLabel = Instance.new("TextLabel", creditsHeader)
  353. creditsHeaderLabel.Size = UDim2.new(1, -40, 1, 0)
  354. creditsHeaderLabel.BackgroundTransparency = 1
  355. creditsHeaderLabel.Text = "Credits"
  356. creditsHeaderLabel.TextColor3 = Color3.fromRGB(245, 245, 245)
  357. creditsHeaderLabel.Font = Enum.Font.GothamBold
  358. creditsHeaderLabel.TextSize = 16
  359. creditsHeaderLabel.TextXAlignment = Enum.TextXAlignment.Center
  360. creditsHeaderLabel.TextYAlignment = Enum.TextYAlignment.Center
  361.  
  362. local closeBtn = Instance.new("TextButton", creditsHeader)
  363. closeBtn.Name = "CloseBtn"
  364. closeBtn.Size = UDim2.new(0, 32, 0, 32)
  365. closeBtn.Position = UDim2.new(1, -36, 0.5, -16)
  366. closeBtn.BackgroundColor3 = Color3.fromRGB(200, 80, 80)
  367. closeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
  368. closeBtn.Text = "✕"
  369. closeBtn.Font = Enum.Font.GothamBold
  370. closeBtn.TextSize = 14
  371. local closeBtnCorner = Instance.new("UICorner", closeBtn)
  372. closeBtnCorner.CornerRadius = UDim.new(0, 6)
  373.  
  374. closeBtn.MouseButton1Click:Connect(function()
  375. creditsModal.Visible = false
  376. end)
  377.  
  378.  
  379. local function addToQueue(songData)
  380. table.insert(songQueue, songData)
  381. updateQueueUI()
  382. end
  383.  
  384. local function updateQueueUI()
  385. for _, child in ipairs(queueList:GetChildren()) do
  386. if child:IsA("Frame") then
  387. child:Destroy()
  388. end
  389. end
  390.  
  391. for i, song in ipairs(songQueue) do
  392. local queueItem = Instance.new("Frame")
  393. queueItem.Size = UDim2.new(1, -16, 0, 56)
  394. queueItem.Position = UDim2.new(0, 8, 0, (i-1)*61 + 8)
  395. queueItem.BackgroundColor3 = Color3.fromRGB(34,34,34)
  396. queueItem.BorderSizePixel = 0
  397. queueItem.Parent = queueList
  398.  
  399. local itemCorner = Instance.new("UICorner", queueItem)
  400. itemCorner.CornerRadius = UDim.new(0, 8)
  401. local itemStroke = Instance.new("UIStroke", queueItem)
  402. itemStroke.Color = Color3.fromRGB(50,50,50)
  403. itemStroke.Transparency = 0.7
  404. itemStroke.Thickness = 1
  405.  
  406. local thumb = Instance.new("ImageLabel", queueItem)
  407. thumb.Size = UDim2.new(0,44,0,44)
  408. thumb.Position = UDim2.new(0,6,0,6)
  409. thumb.BackgroundTransparency = 1
  410. local thumbCorner = Instance.new("UICorner", thumb)
  411. thumbCorner.CornerRadius = UDim.new(0,6)
  412. setRemoteImage(thumb, song.image)
  413.  
  414. local itemTitle = Instance.new("TextLabel", queueItem)
  415. itemTitle.Size = UDim2.new(1, -64, 0, 26)
  416. itemTitle.Position = UDim2.new(0, 56, 0, 6)
  417. itemTitle.BackgroundTransparency = 1
  418. itemTitle.Text = song.title
  419. itemTitle.TextColor3 = Color3.fromRGB(240,240,240)
  420. itemTitle.TextSize = 12
  421. itemTitle.Font = Enum.Font.GothamSemibold
  422. itemTitle.TextXAlignment = Enum.TextXAlignment.Left
  423. itemTitle.TextTruncate = Enum.TextTruncate.AtEnd
  424.  
  425. local itemArtist = Instance.new("TextLabel", queueItem)
  426. itemArtist.Size = UDim2.new(1, -64, 0, 18)
  427. itemArtist.Position = UDim2.new(0, 56, 0, 30)
  428. itemArtist.BackgroundTransparency = 1
  429. itemArtist.Text = song.artist
  430. itemArtist.TextColor3 = Color3.fromRGB(170,170,170)
  431. itemArtist.TextSize = 10
  432. itemArtist.Font = Enum.Font.Gotham
  433. itemArtist.TextXAlignment = Enum.TextXAlignment.Left
  434.  
  435. local removeBtn = Instance.new("TextButton", queueItem)
  436. removeBtn.Size = UDim2.new(0, 36, 0, 36)
  437. removeBtn.Position = UDim2.new(1, -44, 0, 10)
  438. removeBtn.BackgroundColor3 = Color3.fromRGB(180,80,80)
  439. removeBtn.TextColor3 = Color3.fromRGB(255,255,255)
  440. removeBtn.Text = "✕"
  441. removeBtn.Font = Enum.Font.GothamBold
  442. removeBtn.TextSize = 14
  443. local remCorner = Instance.new("UICorner", removeBtn)
  444. remCorner.CornerRadius = UDim.new(0,6)
  445. removeBtn.MouseButton1Click:Connect(function()
  446. table.remove(songQueue, i)
  447. updateQueueUI()
  448. end)
  449. end
  450.  
  451. queueList.CanvasSize = UDim2.new(0, 0, 0, #songQueue * 66)
  452. queueFrame.Visible = #songQueue > 0
  453. end
  454.  
  455. local playbackMonitor = nil
  456.  
  457. local function isPythonServerRunning()
  458. local ok, res = pcall(function()
  459. return game:HttpGet(PYTHON_SERVER .. "/health")
  460. end)
  461. if not ok then
  462. return false
  463. end
  464. local success, data = pcall(function()
  465. return game:GetService("HttpService"):JSONDecode(res)
  466. end)
  467. if success and type(data) == "table" and data.status then
  468. return true
  469. end
  470. return true
  471. end
  472.  
  473. local function startPlaybackMonitor()
  474. if playbackMonitor then return end
  475. playbackMonitor = task.spawn(function()
  476. while true do
  477. if not isPlaying then
  478. break
  479. end
  480.  
  481. local ok, res = pcall(function()
  482. return game:HttpGet(PYTHON_SERVER .. "/status")
  483. end)
  484.  
  485. if not ok or not res then
  486. break
  487. end
  488.  
  489. local statusData
  490. local decodeOk = pcall(function()
  491. statusData = game:GetService("HttpService"):JSONDecode(res)
  492. end)
  493.  
  494. local status = nil
  495. if decodeOk and type(statusData) == "table" then
  496. status = statusData.status
  497. end
  498.  
  499. if status == "finished" or status == "stopped" then
  500. isPlaying = false
  501. isPaused = false
  502. playButton.Text = "â–ļ Play"
  503. playButton.Visible = true
  504. pauseButton.Visible = false
  505. stopButton.Visible = false
  506. task.wait(0.5)
  507. if #songQueue > 0 then
  508. playNextInQueue()
  509. else
  510. setStatus("✓ Queue finished", Color3.fromRGB(100, 200, 100))
  511. end
  512. break
  513. end
  514.  
  515. task.wait(1)
  516. end
  517. playbackMonitor = nil
  518. end)
  519. end
  520.  
  521. local function playNextInQueue()
  522. if #songQueue > 0 then
  523. local nextSong = table.remove(songQueue, 1)
  524. updateQueueUI()
  525. currentSongData = nextSong
  526. songTitle.Text = nextSong.title
  527. songArtist.Text = nextSong.artist
  528. setStatus("đŸŽĩ Playing: " .. nextSong.title, Color3.fromRGB(100, 200, 100))
  529.  
  530. local success = pcall(function()
  531. game:HttpGet(PYTHON_SERVER .. "/play?path=" .. nextSong.path)
  532. end)
  533.  
  534. if success then
  535. isPlaying = true
  536. isPaused = false
  537. playButton.Visible = false
  538. pauseButton.Visible = true
  539. stopButton.Visible = true
  540. startPlaybackMonitor()
  541. else
  542. setStatus("✗ Failed to play song", Color3.fromRGB(200, 100, 100))
  543. isPlaying = false
  544. playButton.Text = "â–ļ Play"
  545. playButton.Visible = true
  546. pauseButton.Visible = false
  547. stopButton.Visible = false
  548. end
  549. else
  550. isPlaying = false
  551. isPaused = false
  552. playButton.Text = "â–ļ Play"
  553. playButton.Visible = true
  554. pauseButton.Visible = false
  555. stopButton.Visible = false
  556. setStatus("✓ Queue finished", Color3.fromRGB(100, 200, 100))
  557. end
  558. end
  559.  
  560. local function setStatus(text, color)
  561. statusLabel.Text = text
  562. statusLabel.TextColor3 = color or Color3.fromRGB(100, 200, 100)
  563. end
  564.  
  565. local function callPythonBackend(link)
  566. setStatus("âŗ Fetching song data...", Color3.fromRGB(200, 200, 100))
  567.  
  568. local success, result = pcall(function()
  569. local response = game:HttpGet(PYTHON_SERVER .. "/fetch?link=" .. link)
  570. return response
  571. end)
  572.  
  573. if success and result then
  574. local songData = game:GetService("HttpService"):JSONDecode(result)
  575.  
  576. if songData and not songData.error then
  577. songTitle.Text = songData.title or "Unknown Title"
  578. songArtist.Text = songData.artist or "Unknown Artist"
  579.  
  580. if songData.image then
  581. setRemoteImage(songImage, songData.image)
  582. end
  583.  
  584. if isPlaying then
  585. addToQueue(songData)
  586. setStatus("✓ Song added to queue", Color3.fromRGB(100, 200, 100))
  587. else
  588. currentSongData = songData
  589. playButton.Visible = true
  590. pauseButton.Visible = false
  591. stopButton.Visible = false
  592. setStatus("✓ Song loaded (ready to play)", Color3.fromRGB(100, 200, 100))
  593. end
  594.  
  595. return true
  596. else
  597. setStatus("✗ " .. (songData.error or "Failed to load song"), Color3.fromRGB(200, 100, 100))
  598. return false
  599. end
  600. else
  601. setStatus("✗ Python server not responding", Color3.fromRGB(200, 100, 100))
  602. return false
  603. end
  604. end
  605.  
  606. local function playSong()
  607. if not currentSongData then
  608. setStatus("✗ No song loaded", Color3.fromRGB(200, 100, 100))
  609. return
  610. end
  611.  
  612. if not isPythonServerRunning() then
  613. setStatus("Python script is not open!", Color3.fromRGB(200, 100, 100))
  614. return
  615. end
  616.  
  617. if isPaused then
  618. isPaused = false
  619. isPlaying = true
  620. playButton.Visible = false
  621. pauseButton.Visible = true
  622. stopButton.Visible = true
  623. setStatus("đŸŽĩ Resumed: " .. currentSongData.title, Color3.fromRGB(100, 200, 100))
  624.  
  625. local success = pcall(function()
  626. game:HttpGet(PYTHON_SERVER .. "/resume")
  627. end)
  628.  
  629. if not success then
  630. setStatus("✗ Failed to resume", Color3.fromRGB(200, 100, 100))
  631. isPaused = true
  632. playButton.Visible = true
  633. pauseButton.Visible = false
  634. else
  635. startPlaybackMonitor()
  636. end
  637. return
  638. end
  639.  
  640. isPlaying = true
  641. isPaused = false
  642. playButton.Visible = false
  643. pauseButton.Visible = true
  644. stopButton.Visible = true
  645. setStatus("đŸŽĩ Playing: " .. currentSongData.title, Color3.fromRGB(100, 200, 100))
  646.  
  647. local success = pcall(function()
  648. game:HttpGet(PYTHON_SERVER .. "/play?path=" .. currentSongData.path)
  649. end)
  650.  
  651. if not success then
  652. setStatus("✗ Failed to play song", Color3.fromRGB(200, 100, 100))
  653. isPlaying = false
  654. isPaused = false
  655. playButton.Visible = true
  656. pauseButton.Visible = false
  657. stopButton.Visible = false
  658. else
  659. startPlaybackMonitor()
  660. end
  661. end
  662.  
  663. local function pauseSong()
  664. if not isPlaying or isPaused then
  665. return
  666. end
  667.  
  668. isPaused = true
  669. isPlaying = false
  670. playButton.Visible = true
  671. playButton.Text = "â–ļ Resume"
  672. pauseButton.Visible = false
  673. stopButton.Visible = true
  674. setStatus("⏸ Paused: " .. (currentSongData and currentSongData.title or ""), Color3.fromRGB(200, 200, 100))
  675.  
  676. local success = pcall(function()
  677. game:HttpGet(PYTHON_SERVER .. "/pause")
  678. end)
  679.  
  680. if not success then
  681. setStatus("✗ Failed to pause", Color3.fromRGB(200, 100, 100))
  682. isPaused = false
  683. playButton.Visible = false
  684. pauseButton.Visible = true
  685. end
  686. end
  687.  
  688. local function stopSong()
  689. pcall(function()
  690. game:HttpGet(PYTHON_SERVER .. "/stop")
  691. end)
  692.  
  693. isPlaying = false
  694. isPaused = false
  695. currentSongData = nil
  696. playButton.Text = "â–ļ Play"
  697. playButton.Visible = false
  698. pauseButton.Visible = false
  699. stopButton.Visible = false
  700.  
  701. songTitle.Text = "No song loaded"
  702. songArtist.Text = "Artist unknown"
  703. setRemoteImage(songImage, nil)
  704.  
  705. setStatus("✓ Stopped", Color3.fromRGB(100, 200, 100))
  706. end
  707.  
  708. local function searchAndPlaySong(songName)
  709. if not isPythonServerRunning() then
  710. setStatus("Python script is not open!", Color3.fromRGB(200, 100, 100))
  711. return
  712. end
  713.  
  714. setStatus("Finding the song, please wait.", Color3.fromRGB(200, 200, 100))
  715. pcall(function()
  716. player:Chat("Finding the song, please wait.")
  717. end)
  718.  
  719. local success, result = pcall(function()
  720. return game:HttpGet(PYTHON_SERVER .. "/search?query=" .. game:GetService("HttpService"):UrlEncode(songName))
  721. end)
  722.  
  723. if not success or not result then
  724. setStatus("✗ Failed to search for song", Color3.fromRGB(200, 100, 100))
  725. return
  726. end
  727.  
  728. local searchData
  729. local decodeOk = pcall(function()
  730. searchData = game:GetService("HttpService"):JSONDecode(result)
  731. end)
  732.  
  733. if not decodeOk or not searchData or searchData.error then
  734. setStatus("✗ Song not found", Color3.fromRGB(200, 100, 100))
  735. pcall(function()
  736. player:Chat("Song not found!")
  737. end)
  738. return
  739. end
  740.  
  741. currentSongData = searchData
  742. songTitle.Text = searchData.title or "Unknown Title"
  743. songArtist.Text = searchData.artist or "Unknown Artist"
  744.  
  745. if searchData.image then
  746. setRemoteImage(songImage, searchData.image)
  747. end
  748.  
  749. playButton.Visible = true
  750. setStatus("Found song! Playing...", Color3.fromRGB(100, 200, 100))
  751. pcall(function()
  752. player:Chat("Found song! Playing: " .. searchData.title)
  753. end)
  754.  
  755. task.wait(0.5)
  756. playSong()
  757. end
  758.  
  759. loadButton.MouseButton1Click:Connect(function()
  760. local link = inputBox.Text
  761. if link == "" then
  762. setStatus("✗ Enter a Spotify link", Color3.fromRGB(200, 100, 100))
  763. return
  764. end
  765. callPythonBackend(link)
  766. end)
  767.  
  768. playButton.MouseButton1Click:Connect(function()
  769. if not isPythonServerRunning() then
  770. setStatus("Python script is not open!", Color3.fromRGB(200, 100, 100))
  771. return
  772. end
  773. playSong()
  774. end)
  775.  
  776. pauseButton.MouseButton1Click:Connect(function()
  777. if not isPythonServerRunning() then
  778. setStatus("Python script is not open!", Color3.fromRGB(200, 100, 100))
  779. return
  780. end
  781. pauseSong()
  782. end)
  783.  
  784. stopButton.MouseButton1Click:Connect(function()
  785. if not isPythonServerRunning() then
  786. setStatus("Python script is not open!", Color3.fromRGB(200, 100, 100))
  787. return
  788. end
  789. stopSong()
  790. end)
  791.  
  792. game:GetService("Players").LocalPlayer.Chatted:Connect(function(message)
  793. if message:sub(1, 6) == "!play " then
  794. local playerName = game:GetService("Players").LocalPlayer.Name
  795.  
  796. if not isPlayerWhitelisted(playerName) then
  797. setStatus("✗ You are not whitelisted for this command!", Color3.fromRGB(200, 100, 100))
  798. pcall(function()
  799. player:Chat("You are not whitelisted!")
  800. end)
  801. return
  802. end
  803.  
  804. local songName = message:sub(7)
  805. if songName ~= "" then
  806. searchAndPlaySong(songName)
  807. else
  808. setStatus("✗ Usage: !play [song name]", Color3.fromRGB(200, 100, 100))
  809. pcall(function()
  810. player:Chat("Usage: !play [song name]")
  811. end)
  812. end
  813. end
  814. end)
  815.  
  816. queueButton.MouseButton1Click:Connect(function()
  817. queueFrame.Visible = not queueFrame.Visible
  818. end)
  819.  
  820. if isPythonServerRunning() then
  821. setStatus("✓ Ready!", Color3.fromRGB(100, 200, 100))
  822. pythonRunning = true
  823. else
  824. setStatus("✗ Python server not running (Start: python spotify_server.py)", Color3.fromRGB(200, 100, 100))
  825. end
Advertisement
Add Comment
Please, Sign In to add comment