Function argument auto complete to show all sounds in folder

If I have a ModuleScript for playing audio and i have the first argument be the sound instance, is there a way to have it autocomplete to show all the audio thats in my sounds folder?

I’ve heard of type checking and I’m not sure if that’s what I would need for this, and it also seems that for type checking (atleast from what i’ve seen anyway) that in my case I would have to type out all the audios names one by one which I don’t think would be ideal as there are a lot of audios and their names could change or have more added.

local SoundModule = {}

function SoundModule.playSound(soundToPlay: Sound, parent: Instance)
	task.delay(nil, function()
		local sound = soundToPlay:Clone()
		sound.Parent = parent
		sound:Play()

		sound.Ended:Wait()
		sound:Destroy()
	end)
end

return SoundModule

Dynamic type-checking hasn’t been added yet (I actually happen to have a feature request about this :slight_smile::+1:), so unfortunately type-checking isn’t able to be used for cases like this where it needs to adapt to new values being added or existing values being modified

This means that we’ll have to work with the limitations of the current type-checking system, which would require either having a predetermined set of names, or a generic dictionary type such as {[string]: Sound}

1 Like