Gun small script

Hey guys! I have a really needed question today, I am planning to make a FPS game in future and I need help with the script. I have a gun model and I know how to make animations for it. I can also script it (sound, animation) but I don’t know how to script one think. Let’s say part called “Bullet” is a bullet and when player clicks, the script shoots the part from gun to position of mouse (To the end of baseplate)

I would really need it, thats all. Thanks for support, bye!


Do you want to actually use a part that will hit a player fired from the barrel, or would you want to use a raycast (I’d suggest a raycast personally, it’s a lot better in terms of FPS systems)?

If you are intending to use a raycast, FastCast, which you can find here is awesome for that sort of thing. Once you’ve completed the cast and done some sanity checks, you can decide how that player will be affected.

I want to do this: when mouse clicked then part called bullet is shotten from barrel to the mouse location and when it hits player, it disapears and it is taking damage (for example 10) and when it hits wall, it just disapears.

Well, it’s not very performant, but you can just use Mouse.Target and tween the bullet to that position. Then you can use Touched to determine when the bullet has touched a surface or a player.

I am asking about the script because I am only basic scripter.

We’re not actually supposed to give scripts out, but AlvinBlox has a good tutorial on the full process to making a gun (which you don’t need, but he walks through all the scripts pretty well).

BRUH, the dev forum is helping me a lot and youtube is nothing. Stop it please.