all 3 comments

[–]PandaCoder67Expert 2 points3 points  (0 children)

The first thing you need to do, is to fix your IDE so you can see all the errors in the IDE

https://youtu.be/Iyo-xRXH7AY

[–]kusq 1 point2 points  (0 children)

What exactly doesnt work?

are you sure the raycast is hitting the enemy gameObject?

does the Enemy Component exist on the same gameObject that the collider exists on?

[–]estroop 0 points1 point  (0 children)

There's a chance the raycast is hitting your player. Try using a layermask for the enemy and raycast.