Heres the script, I’m struggling to make the magnitude. Radius as in a 3 dimensional direction of a player. Similar to a circle being around the player. I want to make it so if it’s in that circle, it’ll get destroyed.
this is a image of what I want to acheive.
local function findTarget()
local agroDistance = Vector3.new(20,1,20)
local hitDistance = 20
local target = nil
for _, v in pairs(game.Workspace:GetChildren()) do
if v:IsA("Part") then
local npc = game.Players:FindFirstChild("AE_LuaDev").Character
if v ~= npc then
if (Torso.Position - v.Position).Magnitude < agroDistance then
agroDistance = (Torso.Position - v.Position).Magnitude
if (Torso.Position - v.Position).Magnitude <= hitDistance then
v:Destroy()
end
end
end
end
end
end
while wait() do
findTarget()
end