Learn how to make a Roblox Game - Smooth Projectiles



Transcript: Learn how to make a Roblox Game - Smooth Projectiles

0:00  
Hello guys, welcome back to my channel and today we're gonna be making smoother projectiles. So you may be asking, What do you mean basement projectiles? Well, when you make a gun and you use body velocity, when you shoot that gun, there's going to be a delay on the bullet. As you can see right here, it's going to be delayed, it's going to lag out. So what we're going to be using is fast cast is the model script using ray casting. And it simulates velocity, right? It's mythography. And the hitbox is really consistent since it uses ray casting. It's going through here it's really smooth. And we're also going to be using raycast hitbox for the hitbox when we're going to be making big projectiles. So when you're using a small projectile, fast cast is good is good enough for you since that box is small on the recasting.

1:10  
But if you're using big blitz done, we're going to be using raycast box. So it works with big boats. Firstly, the gun force you know the bazooka bazooka the gun. And it's like that. So you need a handle, we're also going to need an attachment for the same position and then you put it in Serato. I'm running this to bazooka, Roglic. Bazooka, right now pedestrians are back. And let's add the scripts. We're gonna be adding remote event a folder with two scripts, local scripts and the server script. So first, let me make that clear all your variable Game dot players dot local players that the most variable most it is player at last. So this gets my friend. And then we're going to be making the modifying variable or mode equals script actually allows me the tool first to script dot parent script dot parent is the folder. And then dot parent again, is the tool then for the remote event, local remote equals tool with a child from the event I used with first child because I need the remote to load in. So I can use this then we're gonna use an event called Tula activated so what are activators is when you click on a tool when you say on equipment till and then you click on it, it will fire this event and then it's gonna connect it to my dysfunction a mood for a mood and it's going to fire or most position was okay. P is the most position right

3:04  
we're gonna be using fast as frustrating. Okay, so this is the forum. This is the guy who made the fast cast module, right. And this is the example down but we just need to get the model key so click on this

3:22  
then just copy this and then we're gonna base this on models and we're gonna put this in server storage. Now that we got the module we can require it

3:42  
local fast, fast, fast class equals first class first class require Kimbra service storage dot passes Redux and then oh yeah, we're also going to need to make the remote variable

4:02  
for this right your script now has made a tool variable first script dot parent, we just a folder, and then dot parent again, which is the tool

4:22  
and then local remodeling tool with for child mode. Same thing as before. Motivate. Okay, so now we're gonna use a model on server event connect function. There's gonna be two parameters, player, it's a default parameter and the parameter we sent which is mouse position. We can use whatever we want. I'm gonna name this mouse position mouse pause right so we're gonna create the first customer we're going to create the castle for to create the castle we're going to make available Kassar news fast Class, don't you? Don't you don't. And then we're going to use castor. And then we're going to fire the Kassar gas or fire, there's going to be a few parameters 12344 parameters, the origin, the origin position, the direction, the velocity, and the behavior, the behavior is going to be for later. But first, we're going to create the, the origin and the direction for site, origin local origin store. But we are all tooled up barrel and done the attachment, not barrel Kuzmin, not all position, it's going to get the actual position since this needs to be evacuated, okay. Again, the direction of direction equals most position minus origin, document or origin. Direction, the velocity I'm going to make the velocity toward and 50. I'm also gonna enable the visualization. Okay. So now it's gonna look like this looking good so far. As you can see, when I point towards my character, there is going to be a green dot because it stopped it stopped moving because it had my bazooka and we don't want that since it will be released before your gun air for your bullet is stopped when it hits your own gun as a target. So that's why we're gonna use fast Casper over the long run will digital we're going to be using first class behavior in classifier there was four parameters origin direction, velocity and behavior. So we're gonna need to make the behavior for local behavior equals classroom dot fit new behavior. Beaver van we can put in our properties like this, right here, like the max distance, or the for my guess params there's a lot you can put in your or acceleration. But we're gonna use I guess, branch now. So let's make all right guess params params equals for less params dot new params dot filter type equals an M dot filter type reg X filter type dot blacklist. So it's going to make our params an ignore list. And then we're going to sample I was told that equipped connect function and wanted accept. It can make it ignore our character params dot filter in certain instances into tool dot parent. So you're going to be asking why to the parent. So when you equip your tool mine, when you call a tool, the tools parent will become your character. See? So that's why we're gonna work to the parent inside the table. Right? So we're gonna put in the prams and record and know beaver we've got I guess params equals params and I'm gonna put in the beaver behavior. So now we should ignore our character and our to just cool. We'll just see. It ignores our character right now. It went through our character. So that's good. I think the velocity is too much let's make it 150 Okay, and then this is done. We're gonna do length change okay, this is the good part. We're gonna add in our blood we're gonna make our blood work with our first class first class make Apollo quick

9:29  
we're gonna make our blitz small just because we want to make it work with past class so don't need to use Vegas box, but we're gonna make it big later. So we can make it work with like acid box right

9:58  
Okay, so now You can put this in request storage or storage, it's up to you to yourself, but I'm gonna use on server storage. It's up to you. And then we're gonna create our bowl. Okay, let's create our point right here. Oh, that's great, right you look at equals Game dot server storage, look, clone. And then and then that's it. I think that's also we're gonna change the properties you see, we're gonna turn off come glide all rolls again, it's not anchored. Okay, so we're gonna parent this to workspace. Okay, now we're gonna make we're gonna use length jeans really. Gasser and we added more face Kassar document change connect function. Function, there is 1234566 parameters cast. Last one last point direction, we're going to be naming theory, since we already have direction variable. Actually even just use direction from eigenaar. I don't want to be confused. Direction, length, velocity, and bullets. But we don't need to use velocity and bullets. So we're gonna remove this okay. Now we're going to put in the prime are the variables, local length equals blood dot size, don't see the verbatim. Okay? So it's basically the center of the blood.

12:00  
And then the offset Local Offset fee frame w 00. Minus length minus 10 is brought in to change the boats you frame

12:23  
C frame equals C frame dot look at last point, first point. No, that's mean plus direction towards peace officer. So if you don't know what this means, you're not really I also don't know. So so all you need to know is that it just moves your blood. Whenever the legs change dissolves, all you need to know just just copy this, you know. Okay, so let's see if this works. If it doesn't work, then I'm gonna try for you it works. That's actually cool. Let me turn off my visualized cast stuff. Let's you know that's really cool. Okay, now we're going to be using redhead. So this is done. None we're gonna be using fast castration. So we're just gonna make this do damage caster. Don't be hit Connect function. So we wanted something that's gonna connect to this function. There is two parameters though it's called, it's called the Ri. And the result, okay, let's print the Ri and the result print Ray was Ray and result result. So, the RE is a table and the result is a table. So the RE re table is filled with is filled with the REA information. The caster then we hit recap result. And so the table is so what's inside the table is the part that it hits the position of the impact, not the position that the art that the position of the impact the position of this not the position of the report, and the normal the material so that was so that's what we're gonna use the result not this, not this garbage. Of this garbage. I'm just gonna call this garbage. Okay, so for the head, we're just gonna make a variable for the head. That equals result, dot instance that was called instance and then character equals hit, find first ancestor, ancestor of class model. So it's going to find out if the hit has an ancestor of a model or not. So if it does, then it's it gets the better, it gets the model. So this is useful for when you hear hear. So when we use let's say we use a parent right here dot parent, parent, and then the gun has the hair automates the rest of the script real quick. Of course, you annoyed because character for a child or class, it searches for the class he would not name humanoid. So it works when it is mean to D, for example, it doesn't matter if the name is D or human or not. Since we're searching for the class name, which is usually not the objective. If you wanted to exist, then you want to attack damage to so that's the Hiraga character hit and so when we, when we hit the hero, let me let me load in real quick. When we hit the hero, it's not going to damage because her dog parent is not what it is. It apparently is not the dummy, the dummy model, it's the accessory. And then one when it's gonna try to find them the humanoid you're not going to find the humanoid since the hero doesn't exist in the accessory they exist inside of the the model. So that's why we use character find first ancestor

17:05  
character hid fanfest ancestral model of class model. So just in case there is no model, we just can look it up parents don't want any errors. I see. Yeah, see Brooks Brooks in the here, and I feel the damage. We're gonna be using big projectiles. Okay, so let's, let's make the project topic real quick.

17:46  
Hold on, the projectile bigger we're gonna make the color red. Right? Here it define. So let's put this in. So switch. So the hitbox is not based on the size of the blood. It's used as recasting and not the size of the blood from the hitbox.

18:26  
See, the boat hits the head. But it doesn't. But it doesn't register the head because the hitbox is small. It relies on the raycasting not the size of the bullet. So that's why we're going to be using router fit box. I don't know why did the boisar fuse the recasted box down for him. It was the guy that made Rick I said box. Okay, so here's the the tutorial. And this is good for making an example. We're gonna have samples. So this is how we get it mocks mocks, we're going to create a part for in an attachment for in putting view type, it's up to you and rename it to that damage point. dmg point. So it's basically a trail of lasers. Similar idea to the simplified version. So as you can see is basically trail of lasers. So we're going to be using that okay. So, first you need to require require the module and then you create the hitbox by using bhakta in and putting the part on the part where when the baud rate when the blood that has these attachments and then it's gonna and then you need to shut the bullet by using his sir it's going to use is going to block this and then for the event when it hits something and as you thought on head that was actually two parameters afternoon Felipe Ramirez hit humanoid and the Rakesh results that's cool that's cool

20:11  
Okay, so now that you know how it works let's make it also let's Let's also get the get module I think yes. Okay, so let's paste in paste in the little box and let's put it inside the workspace inside the city. Okay, let's insert this and put it inside through storage that require the module cast box white box for HIPAA free inbox choir game was storage dot Vegas so yeah let's also add in the damage points let's make this almost invisible so we know what we're working with. So this so we're making the Xbox right now I think I'm spending too much time on this leuchars in English to directement worth putting in this sort of authority to the transparency to zero and let's make make it work. can do something like this local hitbox equals oops re hitbox box dot new the object which is Kim which book and then request params equals params Yeah, I checked I just checked people in our prime so it ignores our character and then we're gonna throw the hitbox or the

22:18  
inbox inside then we're gonna move this hitbox on how to damage any let's see if this works yo works Hold on let me make it print the head make it print something print

23:01  
just do something random okay so here's the problem it attacks humanoid well really it attacks you meet well but it doesn't attacked parts as an attack the grounding auto let me remove this real quick let me remove this print it because it's really annoying. Also we're gonna remove the the red lines that are the leader of things since it likes my game so much hitbox visualize visualizer equal false there should be no live things he works so we're gonna make it a tech parts also we're gonna make the tag non human rights how Okay, so let me open up the AP recommendation robot you need to change the detection type see when we find the one okay the tech Moria dashboard. So we need to change that adduction mode to partner to so in to change the detection mode to because the default one only checks the humanoid lawn checks for him right for the two checks for every single part three it'll keep checking even though in here it already hit depart. Obviously in order change the tax mode like this, okay. Boxer attention mode equals to get and then it should work. More this I also had the result. Kay, let's This works it should work and it's detecting the ground we always go cool that's called a goal. We're also going to be destroying the what wanted to glide to something let's try and remove splicing some wooden add ad explosions you know, local explosion explosion equals instance new explosion explosion opposition explosion opposition equals result opposition result position is the impact position that the collision position the equation of the Raycast and hit then witness at the parent explosion apparently should work now okay works. Okay, so that's it for this video. I hope you learned something wrong. I hope you understood what I said. And see you next...

LihatTutupKomentar