Detecting Player In a Certain Area Question

Apart from plugins you’ve probably already heard about (ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries).
There are a lot of different possible options for area detection:

One: Humanoid.FloorMaterial

Using humanoid.floormaterial, you could get the material the player is standing on every time the material of the floor changes. For example, if the humanoid steps onto a part which has the grass material, play grass stepping noises.

Two: Raycasting

You could cast a ray downwards from the player humanoid root part after a set amount of time (or every frame using BindToRenderStep) and run some code if say, the RayCastResult.Material was grass.

Edit: I wouldn’t suggest using touched functions as the result tends to be inaccurate. On the other hand, if you are going to use raycasting, you should use the new raycasting methods, as ray.new() has been deprecated.

5 Likes