resource.AddFile( "sound/" ) --add sounds here resource.AddFile( "sound/" ) resource.AddFile( "sound/" ) -- Sounds played when the innocent win local InnocentWinSounds = { -- start the table of sounds "re/soundname1.mp3", -- make sure the commas separate the table entries "re/soundname2.mp3", "re/soundname3.mp3" -- no comma on the last one } -- Sounds played when the traitors win local TraitorWinSounds = { "re/soundname4.mp3", -- you don't need the 'sound/' part, just the name of the folder where you have the end round songs, the filename, and the extension (.mp3, .wav), i.e. "endroundfolder/soundname.mp3" "re/soundname5.mp3", "re/soundname6.mp3" } -- Sounds played when time is up local OutOfTimeSounds = { "re/soundname7.mp3", "re/soundname8.mp3", "re/soundname9.mp3" } for k, v in pairs ( InnocentWinSounds ) do --loop through all the sound files in the folder that you want the sounds in and pre-cache them util.PrecacheSound( "sound/" .. v ) --you can have other sounds but put the ones you want for endround in one folder end for k, v in pairs ( TraitorWinSounds ) do util.PrecacheSound( "sound/" .. v ) end for k, v in pairs ( OutOfTimeSounds ) do util.PrecacheSound( "sound/" .. v ) end local function PlaySoundClip( win ) -- this function plays sounds at the end of the round, the argument to this function will return either WIN_INNOCENT, WIN_TRAITOR, or WIN_TIMELIMIT if win == WIN_INNOCENT then -- if innos win... BroadcastLua('surface.PlaySound("'..InnocentWinSounds[math.random(1, #InnocentWinSounds)]..'")') -- then play a random sound from the sound table above elseif win == WIN_TRAITOR then -- etc BroadcastLua('surface.PlaySound("'..TraitorWinSounds[math.random(1, #TraitorWinSounds)]..'")') elseif win == WIN_TIMELIMIT then BroadcastLua('surface.PlaySound("'..OutOfTimeSounds[math.random(1, #OutOfTimeSounds)]..'")') end end hook.Add("TTTEndRound", "SoundClipEndRound", PlaySoundClip) -- this hook calls the function above when the round ends