Why isn't my sound playing?

Yes there all on since I was able to hear yours, ill mess around with it a bit and ill reply if I can get it to work or not :slight_smile:

2 Likes

Ah ha, Ive found the issue! Turns out I had to wait for the player added then check if they own the gamepass. I dont know why/how that fixed it but it works, thanks for all your help! @Trayeus @WEcompany @55167233gf @IEnforce_Lawz

1 Like

Also @Trayeus how would I add a blacklist audios? So if there loud or not appropriate how do I stop it from playing?

1 Like

Easy! :slight_smile:

-- The SoundId I used: 323899165
--local MarketplaceService = game:GetService("MarketplaceService")
local soundCommand = "/music "
--local gamepassId = 15075233

local blacklist_sounds = {
	"323899165" -- the sound I provided
}

game.Players.PlayerAdded:Connect(function(player)
	--if MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassId) then
		print("Player owns pass.")
		player.CharacterAdded:Connect(function(character)
			local boombox = game.ServerStorage:WaitForChild("Boombox"):Clone()
			boombox.Parent = character

			player.Chatted:Connect(function(message)
				if message:sub(1, soundCommand:len()):lower() == soundCommand:lower() then
					local soundID = message:sub(soundCommand:len() + 1)
					if not table.find(blacklist_sounds, soundID) then
						boombox.Handle.Sound.SoundId = "http://www.roblox.com/asset/?id="..soundID
						boombox.Handle.Sound:Play()
					end
				end
			end)
		end)
	--[[else
		print("Player does not own pass.")
	end--]]
end)
local blacklist_sounds = {
	"323899165" -- the sound I provided
}

Just add sounds to this list you want to block.

if not table.find(blacklist_sounds, soundID) then

This if statement will check if the sound is not blacklisted, and if it isn’t then it can play. Else it will be ignored.

Is there another way I can do so without having to put in every audio thats bypassed?

1 Like

Not sure as there are so many sounds on ROBLOX I’m not sure it’s possible you could police them all. Maybe if someone else had an API that had a DataStore of popular blacklisted sounds you could link it to that, but nothing I would know of.

You could maybe use a report system where users can report sounds to you and you add them to the list that way, but once again that would mean you have to manually edit the list.

1 Like