function module.getInRange(entityModel: Model, range: number, angle: number)
local characterPosition = entityModel:GetPivot().Position
local overlapParam = OverlapParams.new()
overlapParam.MaxParts = 1000
local allInBound = workspace:GetPartBoundsInRadius(characterPosition, range, overlapParam)
local entityInRange = {}
local forwardDirection = entityModel:GetPivot().LookVector
local angleThreshold = math.cos(math.rad(angle / 2)) -- later
-- tester part
warn("All in bound:",allInBound)
for _, v:BasePart in allInBound do
local parentModel = v.Parent
if parentModel.Name == "Tester" then
v.BrickColor = BrickColor.new("Really red")
end
end
return allInBound
end
Is the range number set correctly? Maybe you haven’t increased it enough. Try adding the 64 integer limit (18446744073709551615), that way you catch all needed parts, no matter the metric.
Didn’t you try making the radius higher? That could be the issue since a script can’t just stop running out of the blue, without a breakpoint after some parts are counted