How to attach a script to a prefab

Hi everyone, I would like to know how I could attach a script to a prefab, because I’m using two objects in this prefab as triggers. The problem is when I put the script in the prefab the triggers don’t work.

The prefab is called “caso1” and the objects in it are called “espaço1.1” and “espaço1.2”.

What could I do in order to solve this problem guys? I’ve attached images to illustrate better what I’m saying and the script that I want to attach.

Can you show how you setup the colliders on your prefabs? Make sure they are set to triggers.

Yes man, they’re set to triggers. I thought that if I attached the script to the prefab it would automatically be in all the elements of it.