So im trying to make a system where a player can put a sound ID for some cash and play that sound
local button = script.Parent local soundBox = button.Parent.SoundBox local event = game.ReplicatedStorage.AdviceSound local db = game.ReplicatedStorage.DiscoDebounce local plr = game.Players.LocalPlayer local marketplaceService = game:GetService("MarketplaceService") button.MouseButton1Click:Connect(function() if db.Value == false then if plr.leaderstats.Cash.Value >= 300 then local input = soundBox.Text local convertion = tonumber(input) if convertion ~= nil then local asset local success, result = pcall(function() asset = marketplaceService:GetProductInfo(convertion, Enum.InfoType.Asset) end) if success and asset.AssetType == 3 then event:FireServer(convertion) print(success) elseif not success then button.Text = "Invalid ID" button.BackgroundColor3 = Color3.new(255, 0, 0) wait(2) button.Text = "Apply ($300)" button.BackgroundColor3 = Color3.new(0, 255, 0) print(result) end end end end end) db.Changed:Connect(function() if db.Value == true then button.Text = "Cooldown" button.BackgroundColor3 = Color3.new(255, 0, 0) else button.Text = "Apply ($300)" button.BackgroundColor3 = Color3.new(0, 255, 0) end end) event.OnClientEvent:Connect(function(name, duration) local fixedDuration = math.ceil(duration) button.Parent.SoundName.Text = "Name: "..name for i = fixedDuration, 0, -1 do button.Parent.Time.Text = "Time: "..tostring(i) wait(1) end game.ReplicatedStorage.SoundFinished:FireServer() button.Parent.SoundName.Text = "Name:" button.Parent.Time.Text = "Time:" end)
and there is a pcall function that checks if the ID put by the user is a valid audio ID but even though I put a valid audio ID the if statement under the pcall doesn't detect it as an AssetType 3 (audio type)?
I fixed it
The problem was that it was AssetTypeId not AssetType