Can't use "is get_script()" anymore

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

In the previous version I used this:

if foo is get_script():

to check if an object was another instance of the script.
Now it gives an error: “right operand is not a type (not a native type nor a script)”.

:bust_in_silhouette: Reply From: Jowan-Spooner

Hey zub_zob,
In godot3.1 you can use the class_name keyword for this. If you set up your script like this:

extends whatever

class_name MySpecialNode


Then you can use:

var node = get_node("lalala")
if node is MySpecialNode:
   print("lol it works")

Hope it works :slight_smile: Good luck!