local randomsound = 1 local delay = 5000 local timeout = 1 function RandomSound_init(e) local timeout = 1 local randomsound = 1 end function RandomSound_main(e) PlayerDist = GetPlayerDistance(e) if PlayerDist =< 500 and GetTimer(e) >= delay then randomsound = math.random(1,4) if timeout == 0 then if randomsound == 1 then PlaySound(e,1) timeout =1 end if randomsound == 2 then PlaySound(e,2) timeout =1 end if randomsound == 3 then PlaySound(e,3) timeout =1 end if randomsound == 4 then PlaySound(e,4) timeout =1 end end else if timeout == 1 then StartTimer(e) timeout == 0 end end end