Help With TTT Round Preparing Music

Hi,

I’ve been working on a simple script to play music during the preparing phase of a TTT round. I’m rather new to Gmod coding so forgive me for my errors.

This is the script I have so far (located in lua/autorun/server)


--TTT Pre-Round Music

resource.AddFile("sound/ode.mp3")

hook.Run ("TTTPrepareRound")
	if TTTPrepareRound then
		BroadcastLua('surface.PlaySound("ode.mp3")')
	else
		print ("The Round Proper Has Begun")
end


The script doesn’t work, but it also doesn’t seem to be putting errors out in console.

If anyone could give me some pointers as to how I can fix this I would appreciate it.

I just tried writing an alternate form of the script, but it isn’t working either. Any ideas?



--TTT Pre-Round Music

resource.AddFile("sound/ode.mp3")
hook.Add("TTTPrepareRound", "Prep", Prepmusic)

local Prepmusic = function()
	if TTTPrepareRound then
		BroadcastLua('surface.PlaySound("ode.mp3")')
	else
		print ("The Round Proper Has Begun")
	end

Prepmusic()
end




if SERVER then
    resource.AddFile "sound/ode.mp3"
else
    hook.Add( "TTTPrepareRound", "PrepSound", function()
        surface.PlaySound "ode.mp3"
    end )
end