Enemy Gets Stuck

GODOT v4.2.2

I just finished Brackey’s beginning tutorial for Godot last night. This morning I was going to start implementing more gameplay but when I opened it up I found out that my enemy AI was bugged. Whenever I start the game the enemy bugs out and gets stuck on the first wall it hits. Sometimes when playing it fixes itself sometimes it does not. I put in some statements and it seems like the raycast is picking up on some collision but I can not for the life of me figure it out. Attached to this is my code and some pictures. Any help would be much appreciated.

EnemyCode


Output

First, your slime has no hitbox to collide with the ground.
Second, try to make it with a charachterbody2D. It’s more simple.

Is there a chance the raycasts are colliding with the killzone? If that’s what’s happening, you can fix it by changing the collision layers.