I've been scripting a projectile weapon (you can think of it as a gun for purposes of this question) using Velocity and a BodyForce to make the projectile fly forwards and have a realistic gravitational effect. All my code is working well, but I've encountered a problem, especially in online mode.
Roblox's Touched event is very glitchy. At times the projectile gets deleted immediately when it hits an object, as it should, but other times it flies right on through that object (it's CanCollide false) without being deleted, especially if the part is thin.
I've been thinking I could implement a kind of raycasting system, but I'm not making a laser gun. Even if I could get the projectile to follow the path of the ray (for visual purposes) I would lose both gravity and the actual time it takes the object to fly through the air, unless you know of a way around this.
Let me know if you want any code to use for reference. Thanks in advance.
-Perci

7 comments
Not really sure how you could do this really, besides by constantly checking distances between every instance and the bullet relative to their sizes. This is what I would probably do: Just make the gun shoot multiple backup shots all at the same time, and use a debounce to make sure only 1 counts. When that 1 hits, all the others are removed. I'm not really sure how effectively this would work, b
-but if you worked it out correctly, it could decrease the chances of the event not firing correctly.
Not sure that's the best solution but it's worth a shot if nobody else has anything better.
I would cast a ray in front of the bullets path, to do this you could somehow get the bullets position change and just cast a ray to that point in front of it.
I tried to post my solution but it goes above the character limit....
Take a look at this wiki article especially the purple target, it may help you http://wiki.roblox.com/index.php?title=Fighting_Lag
Any way you can summarize the solution, digital?