sound.PlayFile Lua problems


sound.PlayFile( "sound/music/MySong.mp3", "", function( station1 )
				if ( IsValid( station1 ) ) then station1:Play() end
				end )

So I need to fit the code above in here:


if math.random (1, 2) == 1 then
	--Here

	else
	--And Here, but a different song
	end 

Problem is, everytime I put it in, I get the

Any help would be great.
Thanks!

sound.PlayFile is a client function. If you call it on the server it won’t work.

-snip wrong-

Ok, so should I go about fixing that?

[editline]26th October 2016[/editline]

Sorry, but that doesnt answer my question :stuck_out_tongue: I just want to play music client side but it wont let me.

Well… yea… That function literally will not work on a server file. Use one of the many other sound playing functions available, or set the code client-side.

Then don’t, because you are.
Sorry for being rude but this makes no sense, and it’s extremely basic stuff.
There are plenty of people that can help, if you can’t then it’s better to just not