So I got this down
textButton.MouseButton1Click:Connect(function() print("Click") local songs,text = results() local sound = DjBoard:WaitForChild("Board"):WaitForChild("Sound") if textBox.Text ~= "" and textBox.Text ~= "Enter in ID" then --print("enter") if DjBoard:WaitForChild("Board"):WaitForChild("Sound").TimeLength == 0 and not songs then print("not playing, added sound") local sound = DjBoard:WaitForChild("Board"):WaitForChild("Sound") sound.SoundId = "rbxassetid://" .. textBox.Text sound:Play() local songName = game:GetService('MarketplaceService'):GetProductInfo( tonumber(sound) ).Name nowPlaying.Text = "" .. songName -- tonumber(sound) ).Name is line 33
But, I'm getting this
--19:26:56.487 - Argument 1 missing or nil --19:26:56.487 - Stack Begin --19:26:56.488 - Script 'Players.Player1.PlayerGui.ScreenGui.ClickEvents', Line 33 --19:26:56.488 - Stack End
What is the issue and what changes are supposed to be made?
It seems tonumber(sound)
is returning nil. This is due to the fact that your 'sound' variable is an object.
You're setting the sound's SoundId by referencing textBox.Text
. You can reference the same string for your GetProductInfo
function.
local ms = game:GetService("MarketplaceService") ms:GetProductInfo(tonumber(textBox.Text)).Name