Let’s start off the bat. So first I don’t know what I’m doing, I don’t think I’m scripting combat properly. Here’s why:
- When I make a Combo Chain, I use a Number Variable that checks the table for the specified combo number like 1-5 for light attacks. This variable goes up by 1 each time you click, and resets after some time of not clicking, or if it reaches 5. This number gets the id for the animation and plays it.
e.g
local Combos = {
"rbxassetid://1"; -- animations
"rbxassetid://2";
"rbxassetid://3";
"rbxassetid://4";
"rbxassetid://5";
}
local ComboNumber = 1
ComboAnimationId = Combos[ComboNumber]
-- Create Animation, Give Id, etc.
- I fire a function, and add a coroutine wrapped around it that looks reaaally messy. This function is what makes me able to check with a hitbox if anyone is in it after the animation plays for the combo.
e.g
function CheckHitbox()
coroutine.wrap(function()
-- create a hitbox, then check if anyone's in it.
end)()
end
There are some reasons that the coding looks really Inefficient to me. For the Hitbox I’m using a coroutine when I probably don’t need it, but I’m using it anyways because it could pause the combat so I can’t run it again since the combat system uses a Debounce, or override the next hitbox if ran two times in a row quickly.
Now for the ComboNumber, the reason I find it inefficient is because I believe there’s probably a better way of doing this, but I just don’t know how. I’ve already made it a habit to use a number variable and table for doing this.