Is There a Way to Ignore Terrain? (.Touched)


I’m using .Touched for a script inside a part.

I have this part moving around hitting things. However, the problem is when the part hits terrain.

The part (using bodyposition to move around) immediately slows down tremendously when it hits the terrain because the terrain is constantly firing the hit function on the part (because it triggers part.Touched). (It will fire the .Touched event over 100x in one second).

I’ve tried using “if not hit:IsA(“Terrain”) then”, however it doesn’t work because the terrain is still firing the .Touched event regardless…

Is there a way to completely ignore terrain when it comes to this? I don’t want it firing the .Touched event at all, but I’ve tried everything and can’t get around it.

Thank you!

Simply firing the Touched event should not be enough to slow things down that dramatically. It sounds like you aren’t properly checking that the touched part isn’t a terrain, so you’re still doing your usual logic when it’s hit by terrain.

It would be really helpful for you if you posted an example of your code.

There isn’t any way to exclude something from .Touched (maybe except from disabling collisions for it) without checking in the callback.
There is no reason why this shouldn’t work:

	if part:IsA("Terrain") then

Well unfortunately with terrain enabled it is slowing the part’s movement down dramatically.

Let me try to be more specific of the problem:

The moving part (via bodyposition) is moving around at a static speed. When it hits another part, it sends that part flying. I’m not going to include that part of the code because that is not the problem.

When testing without terrain, it works very well. The moving part is staying at its static speed, and the parts that it is tossing are also getting tossed without any lag.


With the terrain on, when the moving part goes through the terrain it IMMEDIATELY slows down. Yes I had the exact code you have listed above. The terrain still slows down the moving part dramatically. Not only that, but if the moving part is inside the terrain, other parts that end up getting tossed by the moving part look like they are getting tossed in slow-motion.

This is what I have had in the code:

if hit:IsA("Terrain") then
-- part is not terrain, do rest of code

The terrain is calling that event over a hundred times per second and I’m almost certain that’s the reason for it slowing down. It works perfectly fine and fast without terrain, but with terrain it slows down. The part moves very slow, and the parts that the moving part hit get tossed in what looks like slow motion with terrain.

Thank you for taking your time to respond though, greatly appreciate any help.

So after some testing, I’ve realized this:

The part was 200 x 50 x 200

I’ve tested it with parts that were much smaller, worked perfect.

So it only occurred when the moving part was much bigger, which I guess is sort of expected.

Decided just downscale the part a bit. Thanks for the help regardless!