I want to find a way to detect if the player is in the range of a part without loops.
I am making a game that has multiple safe zones and by using loops it could get a bit confusing because if I am in one of the safe zones the other one still functions because I am outside of it.
I usually use if (Part.Position - HumanoidRootPart.Position).magnitude < 50 then
No matter what you’re using (magnitude, region3, etc.), you’re probably going to need to use some sort of loop. As far as I’m aware, there aren’t any events that are fired when a part enters/leaves a region3. Maybe a feature request in the future.
If you really need something that isn’t through a loop, you could try using the (.Touched) event on parts, but they might be a bit janky.
Ok so, Using Part.Touched isn’t reliable in the game I’m making since the player is sometimes connected to other parts by weldconstraints so instead i use magnitudes. But it came with a draw back the 2 safezones will make the safezone gui not visible when you are out of range, because you are in one safe one and not the 2 of them the other safe one will try to make the gui not visible and the other will try to make it visible which is really annoying
So it sounds like your 2 safezones are a bit close to each other. The easy solution would be to separate them. If that’s not possible, then I would say there’s probably a solution using your current loop. Could you send all or some of the code?