Trying to loop a sound after ENT:RunBehavior is completed (nextbot)

Im trying to play the vo/npc/male01/oneforme.wav when the animation is completed, and have it repeat at random intervals. Im new to coding lua and Im sure what I am asking is very basic to most of you. Anything to point me in the right direction would be very appreciated. Thank you




AddCSLuaFile()

ENT.Base            = "base_nextbot"
ENT.Spawnable        = true
ENT.Name             = "Mark"
ENT.starthealth        = 100

function ENT:Initialize()
    self:SetModel( "models/humans/group03/male_05.mdl" )
    self:SetCollisionBounds( Vector(-4,-4,0), Vector(4,4,64) ) //temporary bot-to-bot collision fix

    self:SetHealth(self.starthealth)
    self:StartActivity( ACT_IDLE )
    
    self.loco:SetAcceleration( 200 )
    self.loco:SetDeathDropHeight( 200 )
    self.loco:SetDeceleration( 100 )
    self.loco:SetDesiredSpeed( 70 )
    self.loco:SetJumpHeight( 58 )
    self.loco:SetStepHeight( 18 )
    self.Completed = false

end


function ENT:RunBehaviour()
    
    while ( true ) do
    if self.Completed == false then 
    
    coroutine.wait( 8 ) //wait 8 seconds
    self:StartActivity( ACT_IDLE )
    self:PlaySequenceAndWait( "roofidle2" )
    self:EmitSound(Sound("vo/npc/male01/oneforme.wav"),800)
    self.Completed = true
    end
        coroutine.yield()
    end
end



still need help

You can make a timer with the time of the animation and then it play the sound
add [lua]timer.Simple( sequencetime, function()
self:EmitSound(Sound(“vo/npc/male01/oneforme.wav”),800)
end)[/lua]

oh man I didnt think of that, thank you. Im going to try it now.