This is my first post, so I’m excited (and scared)!
Anyway, I am just beginning to experiment with Region3, and I have learned how to properly detect players who have entered a region, and I would like to know if there is an effective and straightforward method to detect if they have left said region. If not, perhaps suggestions as to how I could possibly go about doing that. My overall goal is to create a local render system for a city project that I am apart of to reduce lag for the average player.
I think I need to stick with region3 because eventually, all the parts inside that region will be rendered locally. I suppose I could do a system of model cloning from RepStorage with touch events. Thanks for your help, btw.
I was on that page a little earlier, and it seemed relatively unclear to me. I’m sure I’ll be able to figure it out eventually. Just wondering if anyone had a simple solution. Thank you for your help.
I don’t know if this would work, but this is my last guess (I don’t use region3 a lot). You can detect when the player enters a region. You could say something like if not InRegion then halt code right after you do what you need. Not sure how this would work though, so I don’t have any examples.
That’s an interesting thought. My mind right now is going towards something like table comparing, or something along those lines. Wouldn’t know how to do that.
Not sure if this works but maybe you could setup a “listening” function, to detect when the player is no longer in the region by using FindPartsInRegion3WithWhiteList for example:
local HumaniodRootPart = ----HumaniodRootPart
function OnLeaveListener(region3,HumaniodRootPart )
local Player = game.Workspace:FindPartsInRegion3WithWhiteList(region3, {HumaniodRootPart} ) -- you might want to connect/integrate your enter region3 function
if Player then
While Player ~= nil do
wait(.5)
Player = game.Workspace:FindPartsInRegion3WithWhiteList(region3, {HumaniodRootPart} )
end
---Player Is no longer in the region3
end
end
The FindPartsInRegion3WithWhiteList function, includes a WhiteList meaning that only Objects within the given table will be return. In other words its only looking for objects in the given object array( 2 parameter)
Another way you can detect if a player is leaving a region3 is by using some math and calculating the space in which the region takes up, after detecting if they are in the region3 you can test and see if the player’s position is no longer in said space
Oh I see now, makes sense. Thanks for your help. That sheds a new light on things. That’s why I like this forum, sometimes it’s nice to get second opinions from someone with an external perspective.