Error in my code that i cant fix

Godot Version

4.4

Question

There is an error in my code when i was trying to make a portal in my game but i doun’t know how to fix it.

Your script extends CharacterBody2D, as written in the error message, which means you can attach your script only to nodes of CharacterBody2D type. The error you get is saying that some node has the script, while not of type CharacterBody2D, but Area2D.

You have a selected node on your screenshot that seems to be a CharacterBody2D, based on the icon, so the node triggering the error is probably another one. Check all the Area2D nodes and see if one of them has the script attached, and remove the script.

1 Like

thanks