How to use WorldToScreenPoint to check if the player is in a frame?

I’ve been trying to find a solution for detecting when the player collides with the edge of the screen and someone gave me an idea to put 2 thin frames on each side and use WorldToScreenPoint to like check if the player is in the frames bounds although I’m not entirely sure how actually do this.

Here’s a video of what I’m trying to do (prevents them from walking further back when they get to the edge)

local pos, onScreen = Camera:WorldToScreenPoint()
if not onScreen then
  -- stop here?


if pos.X < 20 then
  -- stop it here?

this doesn’t help I already know this information lol I don’t know how I can use a frame though if that’s even possible