Ah, I don’t know what does your script look like? It worked perfectly for me as you can see in the image
I found more information below the reply on the thread you could try this one too
local hrp = plr.HumanoidRootPart -- something idk im writing this quick
local hrp2 = plr2.HumanoidRootPart
local vector = hrp.Position - hrp2.Position
local magnitude = vector.Magnitude
local radius = 3 -- change to what you want
local angle = 45 -- threshold for the angle
local dot = hrp.Position:Dot(hrp2.Position)
if dot >= 0 and dot <= 0.707 )
if magnitude <= radius then
-- code that you want to do after you detect
end
end
Just edit it to your version of the code and try it out, sorry for the bad formatting, I am on mobile
No, but you need to raycast again every 0.1 or so seconds so it updates, btw I forgot to tell you but I recommend the script should be a startercharacterscript (or you can do .characteradded)
So I’d check if the dp was greater than 0, and if the angle was >= 45?
Checking the dot product would be unnecessary at that point, if it is negative then the angle is greater than 90 degrees which checking the angle itself would prevent anyway.
You would just have to make sure that angle <= 45
, which would mean that it is within the view wanted.
Figured it out. With a little testing, checking if angle > 90
is the correct view I require. Thanks!