How to make a game in roblox - Roblox Combat System HITBOX PROPERTIES (OOP) (episode 4)

Transcript: How to make a game in roblox - Roblox Combat System HITBOX PROPERTIES (OOP) (episode 4)

Hello guys, welcome back to the combat trees. Today we'll be making the Opie our object oriented programming. It's basic, it's basically like instance, you know, that hitbox has property, it has an event and you can connect the event. Oh yeah. In my script, I use a thread module, right? For the delays, and for the, for the thread functions, but actually, but I just found out that task libraries are thing, it's been a thing for a while, but I didn't know about them, you know. It's the same as my third module, but it's from robots itself. See, that's totally silly, but it doesn't get throttled. So we're gonna be replacing that right now. Vito casing this plastic lay there's also tested wheat, which is bigger remove this custom touch and then remove this don't need this anymore Peter to task ask ask okay, and then tough to beat okay so for the Opie there's a a dev forum about this community tutorial about Opie if you don't if you want to understand it in more detail, Alden blocks also made a video about it open blocks in my man Alvin blocks. And I'm not going to be going into details on how meta tables work, or how and what are the middle tables functions are, I'm just going to simplify things to make this video not long you. Okay, first, we're gonna make meta table. So I'm gonna explain what meta tables are with the script real quick.

Local people

from here's table I'm going to make a shrink out of it. Hello, then, here's a metal table equals, it's going to be my meta table. And it's going to be my table. And then we're going to set the meta Table to Table segment a Table, Table. Table to meta. Okay. This is my table. The first parameter is your table. And the second parameter is your meta table. And for this, we're gonna do mirror dot underscore underscore index. It's metaphoric ism method. So this basically means index is inside of this, okay? index file function actually no matter and then we're going to print people too it's gonna print No, right? Because it doesn't exist. But if it is something like this, once you return five it's gonna print a fingerprint for now five, my bad. My brain isn't working. Oh, sorry. Okay, so that's basically how meta tables work. It basically sets a default value to something that isn't that doesn't exist, right? There's going to be really useful for our properties and attachments. And that's gonna be really useful. People like to say all meta tables are basically more powerful versions of a table. That's just such a better explanation. I don't understand why people say that. It is, it makes tables really good. But you don't explain it by saying it's really powerful I think I've learned the wrong, my bad. case. So, for this, we're gonna make a meta table. Actually, we're gonna use the modules as a meta table module underscore index equals module. Okay. So basically the same as being this but this is cleaner after you can't even do this, yeah, it's going to be an error, since it can reference the, the table inside of the table you to use a doc

and then we're gonna make an attachment function module. Start so what this does is it's going to start

the it's going to start the function it's going to start at the dock basically. Okay, so the box then, we're gonna do we're gonna do modules on new Construct function function module dot u. So this is basically our instance you know this basically our instance that you This is where we create the box okay, then we're going to make up probably table


put hitbox inside of this properties hitbox equals this Oops, my bad then properties dot range without Ange? No, of these duration we we actually, should we put a duration Na, probably thought hitbox hitbox of everyone, we already have a probably start character with the above stocks equals new oops. And then yeah, that's just what we need that character Oh, let me check this okay. The character rather hitbox the range duration this dot region we can put this inside of parameter we should put this instead of parameter care

range completion

by the way, we can also you don't have to use the parameters okay, we can access the properties by just doing this hitbox the range hitbox dot duration we don't have to use the parameters if you want if you don't want to


so this actually no checkbox for us to care for the information. I first put the character last character and then what this instead of here the range you can set the marital so it actually says the marriage table. Remember what the table the first for the middle table properties and then properties and then your module and then we're gonna return the properties, turn the properties. So this function can access to this. Okay

then we're going to do this just going to copy this and copy all of this okay so instead of the set of using parameters we can just do something like this Look at her care because self character self is basically this property of the this political so we're going to use the start of this the start function using so this function is basically an attachment right you can do so in an actual script or like this hitbox customer view right and then to start the hitbox you get box start. So, this is basically an attachment

okay this is basically the pattern then local ration it will solve the

local hitbox it calls

Salford box in the range local range age

Oh yeah,

also we need also to we need to make a table for the parts local body parts since our combo uses more than one part, right he uses the Wii U just the right hand is the left hand, right leg, left leg maybe we'll let me check Risto

let me check first let me find out right, right, right right arm, left arm, weight right arm, right arm, left leg, left arm,

right leg and left home and this needs to be in order by the way Okay, okay okay okay.

Equals character.

Right right arm, right arm and then character. Left leg okay, okay, okay. Character. Left arm

go right, left arm, right

character left arm. This needs to be in in the combos are okay, this is combo one copper one uses right arm combo to use left leg. So this needs to be in order for the body parts lineup. Okay. We're going to do we're in and then we're going to create the hitbox box. It was not going to get back to you the report let me check the parameters. Look at the hitbox basically the body parts and we had an S chloral body parts. Combo. If the combo is one, it's going to use right arm if the combo is three is going to use the left arm so that's why we added a square bracket combo okay. The duration

and the range. The range should be like What's the range be? I think three is fine. Three, it should be the range than

we should it should be called 27. Okay, okay, it's fine, fine, fine. Point 27 Okay and

box start

and then okay and then we're going to do wait a minute actually, we should um, make this on a different thread remove this after we won 15 there so it doesn't yield the script and then you will again just goes right to your okay. And then we do Oh yeah. Oh yeah. Oh yeah, I forgot the event. Oh yeah. So we're going to make the event properties dot event equals instance dot new vital events it's basically like remote event but you don't need a plea you don't need but it doesn't need something like on server event you know just needs okay it's so when you connect event just needs like one of Librem event an event dot event connect function and it doesn't use fire server or for client just fire we're gonna use vulnerable event okay and then when it finds the the character okay when you touch the character instead of making it take damage we're going to fire the event self dot event fire Okay, we're gonna fire and then this is going to be the parameters it's going to fire the hit but it hits a normal it's called park so it's gonna find out what it hits the park and then it's gonna fire the humanoid okay and then we're gonna just do something like this so basically when we're gonna run we're gonna make the character take damage and just do all this above that event event hit the hip then like take average five let's see if it works Oh Nair looks like he's not felt left capital L There we go. Let's see if the works fine first showed


I forgot to put in the character now the tree Okay, okay no errors. See it works. It prints what it is what it backs dot event dot event looks ugly. So we're going to use dot Tatra. We're going to rename this to dot touch. How we making into it For the properties touched,

equals properties event to event. So we don't need to use. So we can just use the touch instead of dot event dot event since dark touch means properties, not even the event.

Store 12 So I'm going to explain why it's to use Mina tables. If you don't use meta tables, right? If you don't use meta tables, then there's going to be an error

attempt to call a nil value. So Coloma start is not a real function. It doesn't exist. So we indexed it to the module script. And then it looks for the function inside of the module script. Okay. We call we call the function, right? The function does not exist in here. Doesn't exist in here. So it looks for it inside of the module script. And then it finds it. So self is basically the property table.

Oh, see nothing