Need Scripting Help please

I am an ameuter at coding but I am currently doing a school assignment and I need some help on the game I am making.

How it goes is when an object’s collider (In my case a Key), is triggered, another object is scaled to 0. Practically making it disappear. How would I do that in code. (I have tried many ways and nothing is working) Anything will help, thanks

Instead of scaling it to 0, you can use

gameObject.SetActive(false);

this will make it disappear in the scene.

If you want to change a object scale gradually (make it shrink) then I’d suggest using something like LeanTween LeanTween - A tweening engine that is up to 5x faster than competing engines! - Community Showcases - Unity Discussions

It will use a call something like:

LeanTween.scale(gameObject, scale, time);

Ok Thanks Heaps