So my question is this: What's the best way to detect parts that enter and leave a radius around the player?
I plan to use this (if we can figure it out) to make a LOD system. If a model/part is inside a set radius, it looks "normal", if it leaves that radius it gets swapped out with a lower quality version.
At the moment I've setup a script that detects parts in a radius, but not when they leave it. The code! (a script inside StarterCharacterScripts)
while wait(1)do
local Point1 =script.Parent.HumanoidRootPart.Position +Vector3.new(10,10,10)
local Point2 =script.Parent.HumanoidRootPart.Position -Vector3.new(10,2,10)
local Region =Region3.new(Point2,Point1)
for _,Part in pairs(workspace:FindPartsInRegion3(Region,script.Parent,math.huge))do
Part.Color =Color3.new(1,0,0)
end
end
If possible, I'd like to have 2-3 layers of outward detection. e.g. If a tree is within 10 studs, it's fully rendered, if it's only within 20 studs, its animations are paused and it's swapped with a slightly less detailed version, and finally, if it's within 30 studs it's swapped out with a 2D image of the tree.
Thanks.

2 comments
In terms of a radius, you can use Magnitude, Region3 creates a square area
The code I posted uses Region3 and dose detect when parts are in the radius. What I'm looking to do is get it to return parts when they leave aswell as enter the radius.