How do i fix this script that plays a sound only IF its a sound

heres the code:

while true do
		for i = 1, #Classics do -- The amount of children inside the folder
			local Song = Classics[i]
			if typeof(Song) == "Sound" then
				task.wait(1)
				Song:Play()
				CS["Classics"].Value = Song.SoundId
				CS.CLSCSongName.Value = Song.Name
				CS.Parent["Classics"].CSong.Value = Song
				PlayNext()

				Song.Ended:Wait()
			end
		end
		task.wait(1)
	end

Sorry for posting a lot today, im having a lot of issues with this dumb radio system.

1 Like

if Song:IsA("Sound") then

This just uses the IsA API.

2 Likes

that worked, thanks! everything i found online before just said use
“typeof” to make sure its a sound.

also for context if u want; in the folder it looks through has sounds and 1 value, so before it errored out when tryna play the value.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.