I'm currently trying to make a targeting system, but it's not working how I want it to. Whenever I try to make it work, it marks everything on my screen, yet I want it only to do that within a certain radius.(For example, looking through a scope; you can only see the things in front of you. That's what I meant by radius.) Is this even possible? Here is my script:
function Target() local b = Cam:WorldToScreenPoint(human.Torso.CFrame.p) if (b==true) then local Spot= Spot:Clone() Spot.Parent=human.Parent.Head end end
So, WorldToScreenPoint actually returns a second value: a bool telling if the point is visible by the screen. I assume you want to put a Spot on every visible character in the camera.
function Target() local b, t = Cam:WorldToScreenPoint(human.Torso.CFrame.p) if t then local Spot = Spot:Clone() Spot.Parent = human.Parent.Head end end