I want to detect when an enemy player or any other player is visible, with me, the local player, locked in first person, inside a frame I have on my screen.
Lets say I am looking at someone with a Frame thats a small square, but big enough around the crosshair that it is larger then the crosshair, and when a player enters that bigger frame it prints "FOUND PLAYER: " and the player name, how could I detect when a player enters a frame on my screen, is it even possible?
local plr = game.Players.LocalPlayer
local screengui = Instance.new('ScreenGui')
local frame = Instance.new('Frame')
local mouse = plr:GetMouse()
function onEnter(gotPlrObj)
if gotPlrObj ~= nil then
print('FOUND PLAYER: ' .. gotPlrObj.Name)
end
end
-- setup the frame and screengui
screengui.Name = "CatchPlayer"
screengui.Parent = plr.PlayerGui
frame.Name = "Frame"
frame.Parent = screengui

1 comment
Something from here might help: https://scriptinghelpers.org/guides/screen-space-conversion-and-back-again