I am kind of sick of asking people on devforum for help, so I decided I should just learn how to do it and digest a little more.
I want to know how to make a gun, rocket launcher, anything that can get something how this game uses their gun and particle effects (my friend hecklefruits game: GAME MOVED - Roblox ) but anyways. I just need some things I can learn about, I want to know the necessary things for making guns similar to that.
I need keywords too. I don’t know all the words. Or posts from other places/youtube videos would be great too. I just don’t want to keep coming to devforum and asking a bunch of garbage that could be redone using completely different methods that would work easier.
I can do tweenservice on my own time, I just want to at LEAST know how to do these things:
Make a shotgun shoot how it would… most of the time
Make bullet holes, or clone parts and spawn them at the mouse’s position
Making a blood system
(This is just optional) Finding good sound effects and music choice.
I know I may be asking for a lot, I am just kind of stressed of having to make post after post of asking about dumb garbage I should already know before I actually MAKE the garbage.
This one depends on how you intend to make your bullets. Most often I believe people don’t make actual projectiles, they instead use raycasting to detect if you hit the target and then apply damage, and effects to the target.
This also usually uses raycasting to get a hit position, in which case you can use the hit position to place a bullet hole decal or a part/attachment with a particle emitter (for blood spatter).
You just have to think about how stuff works. Like assuming a spread shot for a shotgun. Each bullet would take a random vector essentially while within a certain spread angle. So you simple randomize the direction of each raycast but cap that vector within a certain angle of the center point. Ie: The vector direction can’t have an angle difference greater than 15degrees from the center point.
How do i keep it within a certain angle? I also don’t know how to raycast multiple bullets. Do i repeat the function? This is kind of why im asking, I don’t know anything about it
One simple way to cap the angle, would be create a CFrame (not attached to any part) just the CFrame data type. Then match the CFrame to gun barrel. The lookVector of the CFrame is now the center vector. Then rotate that CFrame 15 degrees up/down/left/right. Now you have 4 vectors within 15 degrees in each main direction. Adding say the Up version vector with the center vector gives you a vector inbetween them. You write a function to randomly create vectors using those preset vectors and you end up with a set of vectors all within 15 degrees of the center. I’m just spit balling here there are many ways to skin a cat as they say.
I don’t have a tutorial for you to follow. I’m just trying to get you to think about what the end goal is. What steps you might have to take to get there. Then you think about what tools does Roblox provide you with to achieve it.
Could you give an example of limiting the spread of a shotgun? I still dont know how to make multiple raycasts too, thats something I am going to need to know for a shotgun
Same way you make one raycast. You could hardcode 20-50 raycasts or you could write a loop to perform a raycast each iteration you change some of the values to get a slightly different result.
it would be suggested to utilize pre-made gun frameworks and get an understanding of their systems/code. I would suggest ACS to start out, they have weapons ready to use once you set up scripts in proper places.
People who make framework guns just overcomplicate their code in my opinion, not even sure what half of the things do. I dont know what things are like, FJEWI_2 or some stuff like that.
So lets look at bullet holes… Assuming its an illusion not an actual hole.
You perform a raycast, the raycast returns a hit. You take the hit position, create a part invisible, put a decal on it of a bullet hole image then position the part at the position you got from the raycast. TaDa bullet hole where you fired. The same concept applies for the blood spatter. You pre-make a blood spatter effect with a particle emitter by changing its color and playing with the settings until it looks like blood spray/splatter. Get your raycast hit position, create the part/attachment at the position and parent the particle emitter to it. TaDa blood spatter where you fired.
Well true, I know but how do i make it face the way the wall/floor is? I know its an illusion, fairly simple, just still confused how i am going to instance a part and decal onto it
The blood splatter effect just sounds like gibberish kinda, how do I make it spawn in the right place anyway?
I don’t like framework guns, too complicated and I go for a cartoon style game. I guess they can be good but they are still overcomplicated.
I checked them out, theres no tools so far as I can see. I do see some, but I don’t know why they add so many variables, and I can’t even find the parts anyway.
The raycast will return a “HitPosition” that is the position in 3D space where the raycast collided with the target. When you create the part you simple parent it to the workspace at that position. As far as where it faces, you can get the CFrame data of the part the raycast hit and rotate the instance parts CFrame relatively or use the opposite lookVector of the raycast.
You can look at other systems and in many cases get some good information about how to accomplish things. But if you want to be able to make anything. Then you’ll need to get into the habit of learning what Tools are available (tools = API methods, Math, Instances of different types) and then thinking through what your trying to achieve step by step and using those tools to achieve it. Too often people simply copy code from other’s systems and then never actually learn anything. So when they need to achieve something slightly different, they are completely lost.
That I still dont know how to do. I know 1, you detect damage or death, 2 you instance a part with a decal on it, and 3 you snap it to the floor, but how the heck do I even get it to rotate the right direction? I still dont know how to rotate it to the right side. Thats what I am asking, how to do it.