Hello, I have this issue with a boombox system I’ve made where I can only play one boombox at a time, Instead of each player being able to play their own song individually.
Here’s the hierarchy.
Server script inside the boombox.
local Boombox = script.Parent
local rep = game:GetService("ReplicatedStorage")
local sound = Boombox.Handle.Sound
local event = rep.Events.PlaySong
local Players = game:GetService("Players")
event.OnServerInvoke = function(Player, Status, Id)
if Player == Players:GetPlayerFromCharacter(Boombox.Parent) then
if (Status == "_Play") then
sound.SoundId = `rbxassetid://{Id}`
sound:Stop()
sound:Play()
elseif (Status == "_Stop") then
sound:Stop()
end
end
end
The local script Inside the UI.
local function PlaySong()
PlaySound(Sounds.Click)
local Id = tonumber(RadioUI.Input.Text)
local Play = Events.PlaySong:InvokeServer("_Play", Id)
local success, Info = pcall(function()
return Services.MarketplaceService:GetProductInfo(Id, Enum.InfoType.Asset)
end)
if success then
print(`\n Id: {Info.AssetId} \n Name: {Info.Name} \n Creator: {Info.Creator.Name} \n Creation date: {Info.Created}`)
end
end
RadioUI.Play.MouseButton1Click:Connect(PlaySong)
