Hello! Thank you for reading this.
I've recently struck an iceberg when trying to develop my game, I've made a shotgun in this game that is supposed to shoot, Well, Like a shotgun. The only problem is that the bullets are very, very out of sync. I want the bullets to be actual objects (small cubes for the time being) whom's velocity control the bullet itself. Is there a better approach for this? Is there any other type of projectile i could use that isn't a physical object.
I've played lots and lots of the game Phantom forces (which is in Roblox) and their bullets look somewhat like lasers and don't seem to be controlled by any physical objects.
I can try to explain how the scripts in my game work: the bullets work by sending a signal from a localscript (that detects if the player is clicking) trough a remoteEvent were a Server side script spawns the bullets.
I've tried lots of solutions but none work, That is if no-one answers this question.
Phantom Forces uses raycasting rather than physical projectiles. Raycasting basically gets two vectors and draws a line between the two. If something is in the way of that line, it returns information about what it hit.
If you are new to this, I recommend reading up on these: https://developer.roblox.com/articles/Raycasting https://developer.roblox.com/articles/Making-a-ray-casting-laser-gun-in-Roblox
Once you get a good feeling about how raycasting works, EtiTheSpirit created a module that does projectile raycasting. What it does is shoots a raycast in multiple segments to get towards the endpoint, creating that bullet travel effect. https://devforum.roblox.com/t/making-a-combat-game-with-ranged-weapons-fastcast-may-be-the-module-for-you/133474
If you don't feel comfortable with this, you can always just make it seem like the bullet is traveling. with part manipulation.
To create a shotgun, you would get the mouse position and add a spread to it. The spread will offset your mouse position randomly making the bullet not exactly on target. If you make it a function, you can use a for loop to run it multiple times. This will make it shoot x amount of bullets each of them having a random spread.