First LocalScript
local Players = game:GetService("Players")
local plr = Players.LocalPlayer
local gui = plr.PlayerGui:WaitForChild("HUD").BoomboxMenu
repeat wait() until plr.Character
local TextBox = script.Parent.Box
local PlayButton = script.Parent.Play
local RS = game:GetService("ReplicatedStorage")
local EventBoombox = RS:FindFirstChild("BoomboxEvent")
PlayButton.MouseButton1Click:Connect(function()
if TextBox.Text ~= "" then
gui:TweenPosition(UDim2.new(0.5,0,1.5,0), 'InOut', 'Sine', 1)
EventBoombox:FireServer("play", TextBox.Text)
task.wait(1.5)
gui.Visible = false
TextBox.Text = ""
elseif TextBox.Text == "" then
gui:TweenPosition(UDim2.new(0.5,0,1.5,0), 'InOut', 'Sine', 1)
EventBoombox:FireServer("remove", TextBox.Text)
task.wait(1.5)
gui.Visible = false
TextBox.Text = ""
end
end)
Second LocalScript
local Players = game:GetService("Players")
local plr = Players.LocalPlayer
local MarketplaceService = game:GetService("MarketplaceService")
local RS = game:GetService("ReplicatedStorage")
local DestroyEvent = RS:WaitForChild("DestroyBoombox")
local BoomboxID = 678537021
repeat wait() until plr.Character
local button = script.Parent.Parent
local audioFrame = button.Parent.BoomboxMenu
local Backpack = plr:WaitForChild("Backpack")
plr.CharacterAdded:Connect(function()
if MarketplaceService:UserOwnsGamePassAsync(plr.UserId, BoomboxID) then
button.Visible = true
else
button.Visible = false
end
end)
Backpack.ChildAdded:Connect(function()
local findBoombox = Backpack:FindFirstChild("BoomBox") or Backpack:FindFirstChild("SuperFlyGoldBoombox")
if findBoombox then
button.Visible = true
task.wait(0)
DestroyEvent:FireServer()
end
end)
button.ImageButton.MouseButton1Click:Connect(function()
if audioFrame.Visible then
audioFrame:TweenPosition(UDim2.new(0.5,0,1.5,0), 'InOut', 'Sine', 1)
task.wait(1.5)
audioFrame.Visible = false
else
audioFrame.Visible = true
audioFrame:TweenPosition(UDim2.new(0.5,0,0.5,0), 'InOut', 'Sine', 1)
end
end)
ServerScript
local RS = game:GetService("ReplicatedStorage")
local BoomboxPart = RS:FindFirstChild("BoomboxPart")
local BoomboxEvent = RS:FindFirstChild("BoomboxEvent")
local DestroyEvent = RS:WaitForChild("DestroyBoombox")
local TS = game:GetService("TweenService")
local info = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, -1, true)
local function playMusic(tween, partClone, soundId)
tween:Play()
partClone.Sound.SoundId = "rbxassetid://"..soundId
partClone.Sound:Play()
partClone.Sound.Looped = true
end
BoomboxEvent.OnServerEvent:Connect(function(plr, value, soundId)
if value == "play" then
if plr.Character:WaitForChild("Torso"):FindFirstChild("BoomboxPart") then
local part = plr.Character:WaitForChild("Torso"):FindFirstChild("BoomboxPart")
local tween = TS:Create(part.Mesh, info, {Scale = Vector3.new(4.5,4.5,4.5)})
playMusic(tween, part, soundId)
else
local partClone = BoomboxPart:Clone()
partClone.Parent = plr.Character:WaitForChild("Torso")
local weld = partClone:WaitForChild("Weld")
weld.Part0 = partClone
weld.Part1 = plr.Character:WaitForChild("Torso")
local tween = TS:Create(partClone.Mesh, info, {Scale = Vector3.new(4.5,4.5,4.5)})
playMusic(tween, partClone, soundId)
end
elseif value == "remove" then
local BoomboxPart = plr.Character:WaitForChild("Torso"):FindFirstChild("BoomboxPart")
BoomboxPart.Sound:Stop()
BoomboxPart:Destroy()
end
end)
DestroyEvent.OnServerEvent:Connect(function(plr)
local findBoombox = plr:WaitForChild("Backpack"):FindFirstChild("BoomBox") or plr:WaitForChild("Backpack"):FindFirstChild("SuperFlyGoldBoombox")
findBoombox:Destroy()
end)