Touched event not firing with anchored objects

I’m creating a gun system, currently i use rays to define the part trajectory, and i tween the part to the destination, however, i’m trying to implement a way to know if the trajectory gets blocked or something.

For example, if a part blocks the trajectory, and the bullet touches that part, then it would register the hit.

I’m trying to use a Touched event for that, the only problem is that the touched event only works with unanchored parts, if you need the script you can ask me.

An example here, i made it so if the part detects a hit, it would turn red:
The results with the unanchored part:
The results with the anchored part:
I thought about updating the ray constantly, but the problem is that i would need to rescript the entire gun system, and another option would be using Region3, but i’m not sure if constantly updating the Region3 would be efficient.

Any help is appreciated. As i don’t know what should i do. Thanks for reading.

Try Using Welds Instead That May Be The Problem

Use raycasts to determine if parts are colliding.

yah… This would be a good time to use raycasting, raycasting to the next position of where the bullet goes. (You wouldn’t use tweenservice since you don’t know when tween actually updates the property), you would need some sort of loop.

With raycasting I could handle 600 to 800 bullets a second, but if you aren’t doing a mad bullet game like me then region3 isn’t going to be that laggy. Unless if your willing to rewrite your whole gun system stick with region3. OR EVEN BETTER :GetTouchingParts()

1 Like

@BaggyChris - I don’t understand what do you mean with using welds. Would you like to explain me?

@NachtHemd - Do you mean the previous option i mentioned before?

You know how you use welds when building a car on studio do the same for this

I would look into the FastCast module for this, Touched just isn’t very consistent for stuff like this.

The reason he’s anchoring the bullets is so tween-service works on it. Welding is not going to help because he has to anchor the bullet.

1 Like