Is this Projectile System good or bad?

Hello, currently I have a Ki Blast move which is the normal basic Projectile used in the Dragon Ball anime genre series, games that are based off of Dragon Ball such as DB Rage, DB Final Stand or the non roblox game called Xenoverse 2 use this type of move. It’s a simple projectile, whenever you do the move the Projectile moves until it hits something, if it hits a Humanoid, it does damage. Pretty simple concept of it, however I am struggling to know if this system I made for Projectiles are good or not, here’s my system:

  1. ClientA fires a Event telling the Server to make a Projectile Part on all of the clients FireAllClients
  2. Clients have a OnClientEvent that creates a Projectile Part with the Position Argument passed from the server (The RootPart’s Position of the Player who fired the event in Step 1)
  3. Clients use Region3 to detect if the Projectile has hit something, if it did Destroy the Part
  4. If the Client is the same as ClientA that fired the Event in Step 1 and the Projectile Hit something, Fire a event with the Position Argument that the Region3 detected a Humanoid at and make a Region3 on the server to validate that there is something hitting the Region3 at that Position

So to recap, ClientA fires a Event that tells the Server to fire another Event to all of the Clients, All of the clients will make a Projectile Part based on the Passed Position Argument from the Server, Clients will then use Region3 to detect if the Projectile hit something, if it did then the Client destroys the Part, if Client = ClientA during that process then we will Fire a Damage Event and from there the Server validates if it’s legit or not using it’s own Region3.

So hopefully I am clear with my post, I know it was a big post :sweat_smile:

If you can give me a much more better and efficient System please do! And also if I was unclear with my post please let me know, I’ll do anything I can to make myself clear.

Instead of using region3, I would just copy the part you are firing from somewhere in the game and just have a touched script that removes the object if it comes in contact with anything. I would also just skip the whole fireallclients thing and just do it on the server as it replicates across to all clients on the server.

Region3 is the most accurate for Hit Detection, .Touched isn’t. The Reason why I’m using FireAllClients is so the Server does less work, also the Projectile Part is just the visual aspect of the actual Projectile System so I believe it should be done on the client rather than the Server.

I think this question is to be in the Code Review Section for there as stated “is intended to be a place where developers can get tips to improve already-working code they have created for Roblox games.” In all seriousness however your method seems good to me, though I’m relatively new to RemoteFunctions myself.

1 Like

Have you tried taking a look at the FastCast module? I think this would be perfect for your situation.

I don’t like using other modules people have created, that’s not my style.

If you’ve been spending your time watching Scripting Support like I have, you may have come across this thread which has been evolving for a while now. Its current topic of conversation is probably exactly what you’re looking for: the best way to create projectiles. I’ve found the entire thread a good read, and it also links to some other useful websites that help explain the best way to go about projectiles. The key is to strike a balance between security and player experience, and it’s a very hard balance to strike.

That’s a bad way to go about it.

dont use region3, and definitely give fastcast a shot if you want good projectiles. (raycasting is a much better approach for projectiles)

not using modules other people have created isnt a good way 2 go about this especially if theyre created for your convenience and are meant for people to use. (not to mention fastcast is hella useful)
i dont use fastcast itself personally but i used it to make a different projectile system where physics and any other properties were determined when the projectile is fired, instead of having a caster object with properties preset. you could do the same very easily if you really don’t want to use fastcast itself.

anyways, from how you describe it, it looks like you’re simply using parts and using region3 every time the part updates. at high enough velocities, your projectiles can phase through walls and players if that’s the case. to counter that, use raycasting. raycasting will be have MUCH better performance than region3 and will get rid of that issue

for networking, this is what i would do

  1. have the main client fire the projectile
  2. fire to every client except the main client to render the projectile
  3. have the main client handle hit detection and send the data to server (not the most secure way but it works)
  4. have the other clients handle hit detection but just for any bullet effects you want/determining when to delete the bullet, dont send it back to the server
1 Like

I use this system occasionally, but I really don’t like to because of how hard to secure it is.

Here’s some examples of how one might cheat:

  • projectiles only exist on the client, so the server has no way to verify its position/speed, which means any exploiter can just teleport their bullets to other players, instantly killing them.

  • exploiters can resize their projectiles to be hilariously huge, killing everything in the map.

  • you can’t really secure them with raycasts because the end point of the projectile can’t be calculated (something could walk into the path of the bullet)

this system is wonderful as far as getting rid of input lag, and probably looks the best, but on the security side I havent found a way to patch these “insta kill” methods.

1 Like

Isn’t Raycasting majority of the time used for instant like projectiles? Not projectiles that are small and move foward?

Yes, raycasting can be used for laser-type weapons, but FastCast implements raycasting to achieve a moving projectile. You can also apply physics to this projectile, which in my opinion is one of its strongest points.

I understand that you’re not a fan of using others’ moduless, but there’s a reason that module was released – so you can use it.

I strongly recommend you use the FastCast module. It is exactly what you need. Even if it’s not yours, this code was released to the public so it is fair game to use. I don’t think it’s a good idea to not use other people’s code to help you with your project, especially when that code was made to make your life easier.

Honestly, I take a COMPLETELY different approach to projectiles.
In summary, I use raycasting to detect where a position is from gun to mouse. On client, you can see a bullet that is moved using TweenService. In both the client and the server, there is an algorithm to detect how long until the bullet is predicted to hit something.

After that time, it will raycast AGAIN to see if something is there. From there there is damage, bullet FX, etc.

That might be more advanced tho.

I don’t care behind the Meaning of a module, whether it’s not intended for free use or it is. That’s not my style, I don’t like using Modules that I can probably already make myself, this is a personal preference choice.

I agree with you, I use RotatedRegion3 because it’s a module that uses advanced & complex mathematical equations in the script that is too heavily above my level in terms of math and incorporating that into Scripting. However, a Projectile module I would rather not use since I can most likely recreate that type of Module, I didn’t come here to seek interest in other modules, I came here to seek interest whether my current system is good or bad.