A script is associated with a specific node. The script must extend that node type. So, at the top of the script, this line must match the node-type the script is attached to:
If you have a script with that extends Node2D (like above), attached to (for example) a
CanvasLayer node, you'll get this error:
Script inherits from native type 'Node2D', so it can't be instanced in object of type: 'CanvasLayer'
So, to fix it, change the
extends XXX line in the script to match the node-type the script is attached to.