hmm use MarketplaceService:GetProductInfo() to get the name and the uploader, and for the played by just use the player that send remote event request.
local textbox = -- textbox path
local remote = -- Remote Event path
local confirmButton = -- confirm button path
local function RequestSong()
local id = textbox.Text
remote:FireServer(id)
end
confirmButton.Activated:Connect(function()
RequestSong()
end)
In a server script in ServerScriptService
local remote = -- path
local SoundObject = -- path
local function playSong(player, songId)
SoundObject.SoundId = "rbxassetsid://".. songId
end
remote.OnServerEvent:Connect(playSong)
the code might not be syntax free
also check the Playing property in sound object
I do suggest doing something like what @danthemanroblox192 , however i would add a check for the InfoType. This would check if it was an audio asset, this also prevents people from using backdoor audios inside of models (Which is super abundant).
For example:
local MarketPlaceService = game:GetService("MarketPlaceService")
local textbox = -- textbox path
local remote = -- Remote Event path
local confirmButton = -- confirm button path
local function RequestSong()
local id = textbox.Text
local Information = MarketPlaceService:GetProductInfo(id)
if Information.InfoType == 4 then
remote:FireServer(id,Information.Name)
else
textbox.Text = "Invalid Id"
end
end
–// inside server script
local remote = -- path
local SoundObject = -- path
local function playSong(player, songId)
SoundObject.SoundId = "rbxassetsid://".. songId
end
remote.OnServerEvent:Connect(playSong)
(Did this very roughly, credits to @danthemanroblox192 , not sure if this will work)
The script looks fine to me, test it out and let me know if you get any errors. I would also recommend putting the “Information.Name” , the arg into a variable and then passing it. Second thing I would recommend is double checking the InfoType in the server again.
WhAt I would do is fa remote sends the id over to the server, the server checks whatever you need and then checks it’s a real ID, then it puts it in a table queue system which your sound player will loop through.