destroy_started = {} function collectable_init(e) destroy_started[e]=0 end function collectable_main(e) PlayerDist = GetPlayerDistance(e) if PlayerDist<100 and destroy_started[e] == 0 then PromptLocal(e,"Press E to collect engine part.") if g_KeyPressE == 1 then destroy_started[e] = GetTimer(e)+0 end end if destroy_started[e]>0 then if GetTimer(e) > destroy_started[e] then Hide(e) CollisionOff(e) KillCount = KillCount + 1 destroy_started[e]=0 Destroy(e) end end if g_Entity[e]['health'] <= 0 then StopSound(e) end end