Tofu/TofuCollect6.cs

A component that listens for trigger collisions to collect a tofu pickup. On trigger it increments a global ScoreManager counter, sets a flag for tofu 6 collected, plays a sound, and destroys its GameObject on the next update when the flag is set.

Networking
using Sandbox;

public sealed class TofuCollect6 : Component, Component.ITriggerListener
{
	[Property] public SoundEvent tofu { get; set; }
	void ITriggerListener.OnTriggerEnter( Collider collision )
	{
		ScoreManager.TofuCount += 1;
		ScoreManager.Tofu6collect = true;
		GameObject.PlaySound( tofu );
	}
	protected override void OnUpdate()
	{

		if ( ScoreManager.Tofu6collect )
		{
			GameObject.Destroy();

		}
	}
}