Loop freezes the game

im trying to make a vision field that will stop you from seeing anything but what he sees in front of him, it works so far but when he rotates near 180 or -180 the game freezes, i have no idea what to do use the arrow keys to make him look right and left and when he looks to close to the left the screen freezes.