sound.PlayFile() Bug With Certain Characters

I made a music player addon on the workshop uses sound.PlayFile() to play the music. My issue is that any files with a period and a space beside each other will throw an error (" ." or ". "). This is an important issue for me since many songs have “Feat. some celebrity” in them.

sound.PlayFile( song, “noblock”, function( CurrentSong, ErrorID, ErrorName ) --If the game is paused this won’t call until unpause

	print("song:" .. song)
	if ErrorID then
		print("ErrorID:" .. ErrorID )
		print("Errorname:" .. ErrorName )


song:sound/gmmp/DJ Snake ft. Justin Bieber - Let Me Love You.mp3

The error description for BASS_ERROR_FILEOPEN is “Can’t open the file”.

I have tried replacing the period and space with \x[HEXCODE] but I still get the same error. Can anyone help me with this error?

try this instead

Just a heads up, you probably shouldn’t have sound files that are uppercase and/or contain spaces in it. Linux hates that and it’s bad to do in general.

That’s not going to work for me because I need to be able to set the time like I can with IGModAudioChannel

Although this is a problem with how the game handles files, have you tried going to the root of the issue? Why not rename the files or remove/blacklist those characters that break it?

[editline]29th September 2017[/editline]

I’m mistaken, you cannot use

file.Write with the .mp3 or .wav extension :frowning: