How can I find out if the part is in the player's field of view and execute some code?
You could try using something called Raycasting. Although I have little knowledge about it, I hear many people say to use this in situations related to your question. Here’s a link that’ll lead you to what Raycasting is :