How to make a gun

Hi! I am making a game called Shell. It is a WW1 First Person shooting game.

I have been tasked with making the guns. I can do animations, models and everything other than the actual shooting mechanics.

How can I make it so that, when you click on the mouse, the gun shoots?

Thanks in advance for any help.

1 Like

Use a remote event to tell the server to shoot, and shoot in the server by casting a ray and damaging the ray result. You can find a lot of resources online about this

1 Like

Your gonna need to use remote events and modules.

I recommend FastCast for this. Its open source and great.

  • Client presses mouse button 1 down

  • Client sends to server

  • Server checks if client actually has gun

  • If does, redirect that to a module or something that can control the shooting.

  • Module responds by creating a bullet with FastCast, and sets settings depending on the gun

  • Module connects fastcast events like position changed, ray hit, pierced, etc.

If you dont want to use fastcast i guess maybe replicate FastCast by creating a bundle of rays that go along the bullets trajectory and tell you when they pierce something and then you can handle it by either creating bulletholes or damaging any humanoids if hit.
Edit: had to do smth, heres Fast cast Making a combat game with ranged weapons? FastCast may be the module for you!

1 Like