No, dont share screenshots, but edit your original post and from the editor top panel you see Insert Code and Inline Code tags. For shorter stuff use inline, but for longer posts use the Insert Code function and paste your code there.
Thank you. You can also fix your code indentation but now it’s at least readable.
Your error is a type error: you’re calling TryGetComponent using variable hitPosition which is of type Vector3. TryGetComponent is a Component API method.
Now, read the error message. hitPosition = target.point;
You’re putting a Vector3 value in the hitPosition and then try to get a Component on it TryGetComponent. Vector3 doesn’t have components other than the x, y and such.
You probably want to use the TryGetComponent on the target variable.
ah, that makes sense, what would you recommend I do instead- again, I really dont have a clue myself, tried to adapt code I found as best I could, but I’m really in the deep end here
Ok I think you’re trying to extract your MineHealth component from the object that you hit with raycast. Then you can use target.collider.TryGetComponent. ps your if (ray) is redundant because it will always be true.
Btw I would rather name ‘target’ to ‘hit’ because it’s the RaycastHit object. Accurate naming is very important, first time programmer.