What are you attempting to achieve? (Keep it simple and clear)
Making a barrier/storm that gets smaller and smaller, and when you are outside the storm/wall/barrier you loose health.
What is the issue? (Keep it simple and clear - Include screenshots/videos/GIFs if possible)
I think I know how I am going to make it. I was thinking of making a part smaller and smaller. And when you touch it, you loose health and you get a warning.
What solutions have you tried so far? (Have you searched for solutions through the Roblox Wiki yet?)
I was thinking of using the method I wrote about, but I think using a touch event that constantly get triggered is quite hacky and buggy. Is there another way of doing it?
Use a mesh with inverted normals(textures facing in), then consider using Forcefield material and some kind of texture to create a cool effect. Remember to tweak the VertexColor.
Magnitude check from the center every X seconds would be probably good, but I don’t really know if it really works. If the player is in the magnitude distance, don’t damage them. Make sure it is not spherical check and that it is checking through X and Z coordinates.
I’m not entirely sure if the looping magnitude check is a good practice. It is recommended to not run the loop too often:
Running the loop like once a second shouldn’t be too much of an issue.
I would agree that a magnitude to check if players are in the “storm” would be the best way to achieve the solution. You would need a centre point in which the storm/barrier closes in on, and also make sure that the speed of the barrier is synchronized with the magnitude checks.
For the case of the barrier changing size, use its X or Z size and divide by 2 for the radius of the entire barrier. It is in the loop and we address the barrier’s position directly within.
Not to mention that the magnitude check is spherical and that’s why you need to do this line below for a cylinder-ish check.
You could create a large sphere that encompasses the whole map and then hollow that out using CSG. You can then decrease the size of that sphere. As far as effects go, you can work based with the sphere in mind (whether you use Touched or check if the player is within the sphere or whatever).