Tweening breaks the touched event

I have a problem. I am scripting a basic rideable griffin that you can ride through the air.

It fly’s using tweening, constantly tweening to it’s next fly to point.

I need it to :Destroy() itself whenever it touches a object mid flight.

The issue is that .Touched events don’t seem to fire while the object is being tweened.

Even if the object is obviously touching something it does not fire the event. My scripting is 100% correct.

Is there any way to avoid this happening?

1 Like

This is a post that Should help with your issue(it gives many possible solutions):

2 Likes

Are you having the touched event in a different script? If not, put in in another script. I think that tweening an object causes to script to finish the tween first before going to the next lines.

It already is in a separate script. Also roblox does not wait for a tween to finish before moving on just so you know.

One method, if it hasn’t been mentioned already, that might work is making a copy of the part that you want to be touched, almost like a collide box and attach it using attachments to the actual tweening object, then check if anything is touching the “collide box”

3 Likes

Yes! That’s actually what I am doing right now! I just came to the realization that this might work right before you posted this. I think this is the best answer as of now.

1 Like

Tweening doesn’t break the Touched event. The Touched event only fires for physics-based collisions where two parts intersect each other. Tweening relates to interpolation of a value, not to physics, which is why the Touched event doesn’t work.

You need to set up an artificial hitbox, much like what jay mentioned. You can also use a Region3 around each movement of your flying object to check if a foreign object is within the native object’s hitbox (use IgnoreList to ignore the character and object); if there is one, you can count this as a hit part.

4 Likes