I am trying to make a music command, and if I do music/ID it will say the asset name.. In other words it will also say a model ID if someone does music/MODELID..
I am trying to make it so it only allows Audio Assets.. Here is what I have
local Player = game.Players.LocalPlayer
Player.Chatted:connect(function(Message)
if Message:lower():sub(1,6) == "music/" then
local Name = "MusicSound"
if game.Workspace:FindFirstChild(Name) then
game.Debris:AddItem(game.Workspace[Name],0)
end
local ID = Message:sub(7)
local Asset = game:GetService("MarketplaceService"):GetProductInfo(Message:sub(7))
local s = Instance.new("Sound", game.Workspace)
s.SoundId = "https://www.roblox.com/asset/?id="..Message:sub(7)
s.Volume = 100
s.Name = "MusicSound"
s.Pitch = 1
s.Looped = true
s:Play()
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = "Now playing song; " .. Asset.Name .. " - ID; " .. ID;
Color = Color3.new(0, 1, 1);
Font = Enum.Font.SourceSans;
FontSize = Enum.FontSize.Size24;
})
if ID and Asset and s then
print("True")
else
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = "Error!";
Color = Color3.new(0, 1, 1);
Font = Enum.Font.SourceSans;
FontSize = Enum.FontSize.Size24;
})
end
end
end)
