For existing users: The module’s version is currently Ver 7.0.0 released on 6 April 2019
In this thread I’ll be showing off a module I made that may prove useful to you: FastCast (Click this to go to the page to get it). This module is really neat, because it uses raycasting (Commonly used for hitscan weapons, like lasers) in such a way that these raycasts can simulate bullet physics.
NEW! I’ve moved the API and tons of other helpful information over to a GitHub page! The link is at the bottom under the How do I use it? section.
So what makes this so important, how can it be a benefit?
Well, if you’ve ever tried making a ranged weapon here on Roblox, you may come across some rather irritating behavior with bullets while playing online. You may see things like bullet lag, jittering / “teleporting”, or even the Touched event of the bullet not firing. These issues can be very problematic to an FPS / TPS, and using hitscan isn’t particularly the best idea since that would require your gun to be modified to not use tracers. This can be harmful for things with slower projectiles, like rockets.
As a direct result of this problem not only being present in my own games, but also being present in other games, I had decided to put an end to relying on bullet physics. The final product of that goal is FastCast.
Click here to get a basic description of how it works, if you're interested in the technical side.
FastCast works by splitting up the line from start to goal into a ton of tiny pieces. These size of these splits is entirely based on velocity and distance. Each piece is used for its own individual raycast. Better yet, this script runs based on RunService’s Heartbeat event - Each heartbeat will make the next cast in line fire off. The result? Bullets that move extremely smoothly and consistently. The best part is that since I use Heartbeat, the bullet will accommodate for lag. In the event of any lag, the cast will move how much it should’ve moved as if there was no lag at all, ensuring that it stays on time and remains consistent to the motion values you specifed.
How do I use it?
Luckily for you, I’ve offered both a ready-to-run example script and full API documentation of my custom objects. You can check out the API (How to script with it, much like a Roblox wiki page) here: https://github.com/XanTheDragon/FastCastAPIDocs/wiki
Click to view some fully-scripted examples
Example Gun: https://www.roblox.com/catalog/02009153526/redirect
Latest update: Added bullet angle variation as requested by post #88
Feel free to reply or message me to give feedback. Hope it comes in handy!