Invalid call. Nonexistent function 'set_modulate' in base 'Nil'.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ultra79

For a school project, I’ve been making a memory game.

(Been following this tutorial: https://www.youtube.com/watch?v=A60dT7RJfO8)

There’s a function to grey out matched cards.

Card1.set_modulate(Color(0.6,0.6,0.6,0.5))
Card2.set_modulate(Color(0.6,0.6,0.6,0.5))

I go to test and while it greys out the cards, after that it gives me the error in the title.

How do you fix this?

Thanks in advance

That means, that Card1 or Card2 variable doesn’t contain the node. You need to provide more code, and please,

format it like this, there is a button for it

USBashka | 2022-07-28 04:51

I agree, either Card1 or Card2 are null.

Add a break point at line Card1.setmodulate(Color(0.6,0.6,0.6,0.5)), check the value of both Card1 and Card2.

godot_dev_ | 2022-07-28 15:41