Disable third person in pointshop?

I have a third person script that works great. But my only problem is that if a player is in third person and they open the pointshop (F3) menu, then their hats don’t show because the player is in third person. Is there any way I can make

ply:ConCommand( "ls_thirdperson 0" )

run only when the pointshop menu is opened? I tried making it run when F3 is pressed but that wouldn’t really solve the problem fully. Any advice?