Roblox How To Make A Combat System (REWORKED)
HTML-код
- Опубликовано: 9 фев 2025
- Yeah so i decided to rework the combat system, because the old one was way too clunky and full of bugs, next video will be about blocking. Wasn't uploading for 3 weeks because i just got back to school, gonna upload a video per week though or maybe more per week
Discord Server:
/ discord
MuchachoHitbox: www.roblox.com...
MuchachoHitbox video: • Introducing.... MUCHAC...
edit: i found the link to the stun handler module
www.roblox.com/library/6448755875/Stun-Handler-V2-1
good tutorial but my combo wont go up, the character is stuck on the 1st animation (could i get the finished code please)
local MuchachoHitbox = require(game.ServerStorage.modules["MuchachoHitboxV1.1"])
local remote = game.ReplicatedStorage:WaitForChild("CombatEvent")
local maxcombo = 5
local sound = game.ReplicatedStorage.sound.punchhit
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:SetAttribute("Combo", 1)
end)
end)
local function SetCombo(character)
local combo = character:GetAttribute("Combo")
if combo < maxcombo then
character:GetAttribute("Combo", combo+1)
else
character:SetAttribute("Combo", 1)
end
end
local function ComboReset(character, oldcombo)
task.delay(1, function()
local currentcombo = character:GetAttribute("Combo")
if oldcombo == 5 then return end
if currentcombo-1 == oldcombo and not character:GetAttribute("Attacking") then
character:SetAttribute("Combo", 1)
end
end)
end
remote.OnServerEvent:Connect(function(player)
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local rootpart = humanoid.RootPart
local animator = humanoid.Animator
local combo = character:GetAttribute("Combo")
local attacking = character:GetAttribute("Attacking")
if attacking then return end
character:SetAttribute("Attacking", true)
local animations = game.ReplicatedStorage.punch:GetChildren()
local animation = animator:LoadAnimation(animations[combo])
local hitbox = MuchachoHitbox.CreateHitbox()
hitbox.Size = Vector3.new(3,3,6)
hitbox.Offset = CFrame.new (0,0,-2.5)
hitbox.CFrame = rootpart
--hitbox.Visualizer = false
animation.Stopped:Connect(function()
ComboReset(character, combo)
if combo == 5 then
humanoid.WalkSpeed = 0
task.wait(1)
end
humanoid.WalkSpeed = 16
character:SetAttribute("Attacking", nil)
hitbox:Stop()
end)
hitbox.Touched:Connect(function(hit, hum)
if hum == humanoid then return end
hum:TakeDamage(5)
end)
animation:Play()
wait(0.16)
hitbox:Start()
SetCombo(character)
end)
@@blaez7933 have you found a solution to this? im having the same issue
@@goshirrr0329 lol no, i have given up on the code and now im playing demon slayer games
publish to roblox? no?
thanks for explaining what goes in the folders in the first 5 seconds of the video
how do i get "fx floder" "hit anims" and "punch anims" PLS
@@itzzdada u have to make ur self or just find animations of all online
fr bruh
@@itzzdada watch the video if you haven't figured it out yet
@@rexar6934 he doesn't explain what goes inside or how to make it
wow.. you have gotten alot better since your original combat system video, this was awesome!
no he sucks
What a noob
@@SoxTeen ok SoxTeen.
Oh god, i dont know what makes me more amazed - how fast you type or how fast you think
it wasn't me thinking fast, it was the video being planned😅
@@SushiMasterOfficial thanks for saying that , I thought I was lagging back by how fast u are
If you are having trouble with the particle, just take a particle from toolbox. Most particles have an attachment with a ParticleEmitter. To get it to work you'll need to type this for the local particle part: local particle = (folder name)["Particle Name"].Attachment.ParticleEmitter:Clone()
Example: local partical = VFX["Hit Particle"].Attachment.ParticleEmitter:Clone()
Then you just continue as normal with the rest of the code. Hope this helps
thanks brother !
I
also realized that the game.debris:additem(attachment, 0.1) does not work, I instead put it under the line you talked about and it worked fined
Is the fx part by the use of module automatically handle by client? or do i have to do it myself
HitServive.Hit(hum, Damage, 1,rootpart.CFrame.LookVector*10, fx) -- this one
u defined what the fx function is when you did local function fx() now when you put it into the parentheses of that HitService part, I'm pretty sure it simply tells the client to do what you just defined (play sound, display particle)
Can anyone tell me how to fix the problem where when I M1 the second set, the animations are twitchy and have a short pause. It slightly plays a part of the animation and then plays the rest repeating. Like a twitchy effect. Please help me! I will appreciate it, thanks
No
Sorry for the question, but what is in folders fx folder and hit anims?
porn
I love this video since I'm not every experienced but at least I learned a lot of things and new ways of combosets and etc.
how do i get "fx floder" "hit anims" and "punch anims" PLS
I need help i can't put the effects it says: Emit is not a valid member of folder "workspace.Anims.HumanoidRootPart.Attachment.Hitfx" pls i need help
18:42 it say "Emit not a Emit is not a valid member of Part "Workspace.Rig.HumanoidRootPart.Attachment.hitvfx"
Did you say :Emit() or .Emit()?
How do you manage to get your body velocities to apply instantly on both perspectives, the attacker and receiver?
Whenever I add a body velocity to someone's root part, they are always knocked back after about half a second of delay from the attacker's perspective, but in the player getting hit's perspective, they get knocked back instantly.
you could try doing the knockback from the client, (fireallclients), so the knockback is smooth for everyone
@@SushiMasterOfficial How do i do that?
@@JSDaddaCraash knock back would be on a client script
@@SushiMasterOfficialCould you please further elaborate?
@@JSDaddaCraash :FireAllClients()
Awesome tutorial bro. worked great
Bro how did u do it? He didn’t link the modules in the beginning except for the hitbox
@@jurassicmustarddorito1712 I am wondering the same thing
Thank you so much! Is it ok if you can add blocking in the next part and on the 5th M1 theres a block break?
yea thats what im planning to do
@@SushiMasterOfficial thank you :)
how do i get "fx floder" "hit anims" and "punch anims" PLS
@@itzzdada make them urself
@@zankyou3812ok but where do u get the fx folder, i dont even know whats in it so how am i supposed to make it myself
Why arent my animations working did i set it 2 the wrong anim priority?
You could also make the module yourself by making an attachment on the players left and/or right arm, and spawning a part on one of those attachments, and just deleting the part after 0.1 seconds. Good module though, even though I cant get it :).
the hitbox one? he made that himself.
@@timatoma8076 he means you, the viewer
d oyuo really have to create a hitbox? Can't you just have a hitbox there all the time and when you punch it has CanTouch on for a little time before going back to not being touchable?
@@whitekingcat5118 if you do you would either have to create a weld or constantly update the position, both instances are probably unfavorable for a traditional combat system. however, the former (welding) could be used but you would have to optimize it for performance purposes.
@@prodbyHUMBLE u can get that one
How do I fix the “LoadAnimation requires an Animation object”
what ever your max combo is you need that many animations i think
yo idk if your still there but i used task.wait(AnimatoinTrack.Length - 0.1) you can put this after you play your animation. I think this is a roblox bug, but this code waits until the animation is finished with a offset of -0.1 you can change the offset value as you desire. Hope this helped! 🙏🙏
Where can i get the folder he used for yhe punches animations i cant find a good one
at the start of the video, where did you get those animations and effects from?
You're supposed to make them yourself
@@SushiMasterOfficial breh
@@SushiMasterOfficial nice one buddy
yo sushi master great tutorial but im getting an error LoadAnimation requires an Animation how can i fix it at this part
local animation = animator:LoadAnimation(Animations[combo])
use humanoid
Make an animation
Small issue, I have more than 1 partical in hitfx, How do i make them play when they be called on?
On the 5th combo, the hit box still stays there for 2 seconds before being destroyed because the wait occurs before it is destroyed. How do I fix this?
When i put another hit:Stop in the if statement there's an error. ServerScriptService.CombatServer:76: attempt to call missing method 'Stop' of table - Server - CombatServer:76
if combo == 5 then
humanoid.WalkSpeed = 5
task.wait(2)
end
humanoid.WalkSpeed = 16
character:SetAttribute("Attacking", nil)
hitbox:Stop()
EDIT: I fixed the bug by adding else statement. Not sure if this is good way of fixing but it works with no errors thanks.
animation.Stopped:Connect(function()
ComboReset(character, combo)
if combo == 5 then
humanoid.WalkSpeed = 5
hitbox:Stop()
task.wait(2)
else
hitbox:Stop()
end
humanoid.WalkSpeed = 16
character:SetAttribute("Attacking", nil)
end)
i think you're supposed to enable visualizer
visualizer = false, not --visualizer = false
where did you get the hit anims and the fx folder and punch anims link please😮
how do i fix this i made my own anims but only the first one plays
do you have an animation model for this i would like to use your anims they look perfect for the theme im goin for
could you make a video of transfering this to client and sending information to server?
all animations are in one anim save? or theres each animation in the folder?
Does this work for r15 rigs?
how can i make the FX apply from the attacking player's hands instead of the attacked player's torso?
example script :
local FX = ur fx
FX.Parent = game.Players.LocalPlayer["Right Arm"]
but this script will make the FX position to middle of your arm
@@zaxdfaker is "Right Hand" a thing?
hella underated man
hey when I put in my animations and test it my aniamtions dont look too good but my animations in the aniamtion editor look okay can you help with this? and by the way idk if this is the problem but I use the same character for startercharacter that I use for animating
Set them to a higher priority, i think ur attack animation is "Fusing" with ur idle animation
@@canalafhaut931 i figured that my idle and movement aniamtions slowed it down but how do I set it to a higher priority?
@@canalafhaut931 oh I figured out the animation priority but is the top the most important or the bottom like is Core the most important or is it Action 4
@@canalafhaut931 wait actually I figured it out
Would there be a way to make it so there could be a dashing system but while dashing the combat gets cancelled out? Just wondering because I’m not that much of a coder.
I probably should’ve started with this but what do I do if I want the player to be ragdolled instead of just knocked back?
@@kewlcookie8622 you can use humanoid states to make player rag dolled, specifically "falling down" although the player will not have the floppy limbs things.
example:
Humanoid:ChangeState(Enum.HumanoidStateType.FallingDown)
(i didnt test this)
Hey I'm just wondering if even though BodyVelocity is deprecated it it's still good to use?
Pretty sure if its deprecated. you shouldnt use it idk
@@SomewhereProbably Ik but most people still use it
Hey pls can you show what you in your folder or we can't make the punch anims ,the fx and the hit anims
you should be able to know whats inside from reading the script, my punch anims folder has 5 animations named with numbers such a 1,2,3,4,5 and my hit anims has 3 animations my fx has 1 particle and 1 sound,
@@SushiMasterOfficial Ty beceause im not a pro in english so script in english it's not ez for me.😅
@@SushiMasterOfficial what are the 3 hit animations for
@@LuxRange havent finished the video but I would assume the hit animations are for when the target gets *hit* ??? Just sayin..
@@Flameyoo 4 months ago bruh
Hey where do i find ur animations
the hit anims and fx folder etc
im new to roblox studios
hello, for the hit anims i think you have to make it yourself. and idk how to work the fx folder. currently asking sushi about it
i make it myself
Why does “Hum” and “character(On the last part)” shows red line?
Hey where do i find the punch anims, hit anims and fx folder? im kind of confused since i believed i followed every step
EXACTLY
make them urself bc the game will sanitize (this means if they're not urs they wont play)
animations u didnt publish
@@omgdiscordemoji yeah, i ended up doing that, i only wanted them to see how they were “structured”
@@jurassicmustarddorito1712 yeah me too, if i understand right. you mind just telling me what i need? like do i need 5 different separate punch animations or just one with 5 punches/just a singular hit animation/what type of fx?
@@yeast00 five separate animations
where can i find the animations you used?
What to put in the fx folder,hit anims and punch anims folders
after the 5th m1 if you walk to another dummy it still knocks them back even without an m1 as long as its within 2 seconds
do you need to make the full combo animation or 1 by 1
1 by 1
what if we have multiple particle effects what do we do then?
how would you go about making the other player ragdoll after being hit by the last m1? Also great video the combat system series has helped me a lot with understanding a bit more about scripting so thank you
@CrZy LT 💀
💀
You would need to have your own ragdoll system, then toggle it after your M1,and then release after a few seconds.
platform stand?
Where do you get your animations?
When I playtest the game, theres an error and it says that this:
local animations = animator:LoadAnimation(animations[combo])
requires "LoadAnimation requires an Animation object"
How do i fix this?
you probably need a punch animation for it
@@azoundL i do have an animation i just dont know how to use it in the code
@@artzella2995 yo idk if your still there but i used task.wait(AnimatoinTrack.Length - 0.1) you can put this after you play your animation. I think this is a roblox bug, but this code waits until the animation is finished with a offset of -0.1 you can change the offset value as you desire. Hope this helped! 🙏🙏
the stuns dont really work for me? like if i hit them they can still hit me? and even still walk
where did you get the fx folder, im too lazy to make fx and i cant the fx folder on the toolbox/marketplace
i cant get those first three models you use in the beginning of the video
You need to make it yourself
How would u make it so there's a tool thats just ur fists so when i click while its unequipped it wont m1 but will if its out ?
--Make your local script this
--And dont forget to change the variables to where your folder is
------
local remote = game.ReplicatedStorage.Combat.Melee:WaitForChild("MeleeRemote")
local UIS = game:GetService("UserInputService")
local IsEquipped = false
------
script.Parent.Equipped:Connect(function()
IsEquipped = true
print("Equipped")
end)
script.Parent.Unequipped:Connect(function()
IsEquipped = false
print("Unequipped")
end)
------
UIS.InputBegan:Connect(function(key, isTyping)
if isTyping then return end
if key.UserInputType == Enum.UserInputType.MouseButton1 and IsEquipped == true then
remote:FireServer()
end
@@victorpena2566 god bless you man! Does anybody know why i keep getting this error in output?
ServerStorage.Modules.MuchachoHitboxV1.1:407: attempt to index nil with 'Key'
and
ServerStorage.Modules.MuchachoHitboxV1.1:424: attempt to index nil with '_clear'
Hi so im making a game and im pretty late i just started watching today and i need the fx folder, hit anims, and punch anims bc i dont have them what will i do please reply ty and i do not have muchachohitbox
you make the animations yourself, and for the hitbox module its in the description
@@SushiMasterOfficial Sushi Master can you have different styles of muchacho hitbox ex. shape or part will the script still work when its just a square shaped hitbox? i tried the first one in muchacho hitbox but i havent finished this script yet
pls reply
@@MxsticNoob its already square shaped? and the script would work if you change the shape you just need adjust the properties
@@SushiMasterOfficial why when i rework the muchachohitbox why is the red thing not showing maybe i did something wrong in the CombatInput??
@@MxsticNoob because you havent turned on the visualizer probably, or you havent started the hitbox
Hi , i need some help , my animations doesnt loads right in the game : it is slower and doesnt go to the end .
turn them into Action 4
Where do I get or what i out in punch anim and etc???
Can you help me at 9:32 when you tested it it didn’t work for me i checked the scripts i didnt see any errors could you help me
Update Im not 100% sure but i think its cause i had nothing in hit anims can you tell me what to pit in there
Hey. If I want to add heavy attacks, do I follow this exact same code as seen in the video or is it different. @SushiMasterOfficial
its slightly different
just check if the player does heavy attack (im assuming it'd be right click) then copy the tutorial, make stun duration a bit longer and damage more
my animation combo glitches out after my first combo, what could be the issue?
yo the anims arent working did i have to do somthing before?
im getting "ServerScriptService.Combat Server:14: attempt to compare table < number - Server - Combat Server:14" whenever i launch te game for the first time, any idea whats wrong?
bro where do we get that 3 things that fx folderr and two of these!!!
idk if im late on this but why i kept getting error on line 58? hitbox:Start() at 8:57
did i missspell or sum?
Nope its just because u have to make the animations and all the other stuff urself and neither of us know how
where do i get the fx folder? or i have to make them myself? cuz idk how to do that...
literally… You waited an entire year but no response, me too bro
help, the hitbox won't disappear and it's dealt no damages
Im actually planning to develop a unique fighting game with the attacks changing depending on the heavy inputs you put in. Like LMB LMB Then charged LMB (Charged Heavy).
"ServerStorage.Modules.HitService:6:attempt to call missing method 'TakeDamage' of table - Server - HitService:6"
How do i fix this thing?
i didnt worked with modules before, so i dont think i understand anything in there
Hello good video/tutorial But i was wondering whats inside the hit anims ,Punch anims and the fx Folders?
I want to know the same thing
It’s in the name.. the Hit anims have the animations for when the player gets hit, punch when the player punches, and the fx is effects. Effects is optional, but you have to make these all yourself.
@@somerandommodelerhi so after you make the animations, im confused what to do how did he make it in a folder?!
@@WhiskerDogs-jh7pg when you go to ReplicatedStorage, there should be a “+” button on the right side, click on it, then search up “Folder”and you’ll find it. For how to put the animations inside the folder, just do the same thing but instead of searching up the folder, search up “Animation”. Then import the animationid into the animation.
what is inside the fx folder what are the names?
EDIT:the particle appears but it doesnt go away i just named the particles hit fx and put then under the fx folder what did u do?
my particle is called hitfx and the sound is called hitsfx im pretty sure, just adjust the code with your object names, no need to copy my code 100%
how you learned all of this? it was on youtube videos?
For some reason it messes up my m1 animations. Any idea on how to fix it?
sushimaster#7840 dm me
can i ask a question: When my sprint anim is play and i clicked m1 to combat but the animation is not work help me pls ;-;
go while making the animations on the 3 dots and click on animation priority or what its called and set the punching animations to action 1 while spring anim is on priority action which is one lower. making it so if you m1 the m1s take priority
@@savekillqqpsounds8473 its work thanks u
very good video i got everything to work apart from the vfx, sfx and hit animations. Any advice or help will be greatly appreciated
about the fx and the sfx i put in the script but it doesent seem to be working. do i need to have effects for it or can i just go without the effects?
Did you fix it, because i have an answer
@@awkwardcheese9692please say the answer
How do I make the animations play '-'
Would this work with R15 if I just rewrote some parts and changed some animations?
try it bruh💀
The stun hanlder module i cant find it pls send a link do download it pls
Since i also cant seem to find it, ill send you the script
-- Credits to ApprenticeOfMadara
--[[
Very simple to use stun module:
Simply send a humanoid object and the amount of seconds you want the stun to last for to the function
Example:
local StunHandler = require(path.to.module)
StunHandler.Stun(humanoid, 5) -->> stuns for 5 seconds
The function saves the current speed and jump power of the humanoid before setting them to 0
Once the specified duration passes, it will reset the speed and jump power back to what was stored
If the function tries to stun an already stunned humanoid, it will compare the duration sent with the time left
from the previous stun
If there is less time left, the stun duration will update to the new one
An attribute with the name "Stunned" is added to the humanoid's parent (character) and set to true whilst
the humanoid is stunned
It is set to false again once the stun wears off
Note: The function does not yield whilst the humanoid has been stunned
]]
--//Private variables & functions
local heartbeat = game:GetService("RunService").Heartbeat
local Stunned = {}
local clock = os.clock
local isChecking = false
local checkConnection
local currentTime
local stunnedHumanoids
local function stunChecker()
currentTime = clock()
stunnedHumanoids = 0
for humanoid, data in pairs(Stunned) do
if not data.stunned then continue end
if currentTime >= data.duration then
data.stunned = false
data.changedConn:Disconnect()
data.changedConn = nil
if humanoid:IsDescendantOf(workspace) then
humanoid.WalkSpeed = data.speed
humanoid.JumpPower = data.jumpPower
humanoid.JumpHeight = data.jumpHeight
humanoid.Parent:SetAttribute("Stunned", false)
end
end
stunnedHumanoids += 1
-- print(string.format("waiting: %f", data.duration - currentTime))
end
if stunnedHumanoids == 0 then
checkConnection:Disconnect()
isChecking = false
end
end
--//Stun Handler
return {Stun = function (humanoid, duration)
if humanoid.Health
hey uhm could u like put a link to the fx folder hit folder and punch folder?
why can i continue m1ing after 5 hits? im really new to this sorry if im askin simple questions
Script is unfinished, i had the same problem
What do you put in the fx folder please tell.
Why doesn't the hitbox show? There are no errors and the animations work, but there is no hitbox. I can't see it and it doesn't deal damage. Please help me
can you use combat system for only your self? like make it only you can have the combat system
"ServerScriptService.CombatServer:61: attempt to call missing method 'Start' of table" what is this mean?
i can do a full combo only once and then it said this
Because the hitbox stopped before it starts, make sure the wait is shorter than the animation length
@@SushiMasterOfficial the task.wait() at really last line right?
@@PriestAsura Yes
1:25 Umm What's that word?
hey dude good tutorial, i did follow the server script but didn't work with printing, where can i find the server script?
Bro how do I get the animations and the punch anims and fx folder and stuff?
true
I am currently at 9:25, the punching animations arent playing, the script just doesnt work
Same
it cause rootpart isn't a member of humanoid. idk how to fix it
Hello man, doing the whole hitbox on the server side can cause delay and make the player experience bad, any alternative for that?
make the animation locally and hitbox server sided
Could you show how to do this?
@@huntinghackers-gamerboycoo7895 How do you do that?
if u do it on client its exploitable
so i suggest doing it on client cause its smooth but just do sanity checks
pls make it availaible for mobile, I really wanna do this but make a episode on buttons for mobile. cuz if you do this mobile players wont punch accidentally
Hey bro, its pretty easy to do, u just create a GUI in starter gui, you add some image buttons or text buttons and inside the button u add a local script that when triggered will send the combat event
@@lepanadere4236 tysm
@@lepanadere4236but if the player is on pc he is going to see these button
@@warmaxgame2120 you can add an if statement when its on pc or mobile, u just need the userinput service and the statement is if UserInputService.TouchEnabled then buttons visibles else buttons disappear
@@warmaxgame2120 how to make it invisible for Pc?
how should I edit the hit anims if I only have 4 punch animations
make local MaxCombo = 4
whats inside the hit anims,fx folder and punch anims
he doesnt show what to name the animations
the particle and sound stays whenever i hit the last m1, any idea how to fix?
have you tried to delete them after ?
also, the stun doesnt seem to work for me. Do you have any ideas to why the stun isnt working?
does the character get the stunned attribute, and if they do get the attribute but still be able to punch, dm me, send me the footage and your code sushimaster#7840
@@SushiMasterOfficial friend request sent, username 3p1c
where can I find your hit anims, fx folder, and animsations
You make your own animations
@@somerandommodeler O ok but do you know where I can get the Fx folder and stuff
@@FleeUnwanted fx folder you either find a fx on the toolbox, don’t add it at all or make your own, although i recommend just finding it on toolbox
@@somerandommodeler hey dude idk what it is but my anims dont work do you know like a solution?
How do you put the fx folder file please?
hey question what do you do about the attribute like when I die and spam my weapon then respawn my attribute is stuck to true so basically I cant use my tool no more
yo ik this is very unlikely to garner a response but when i get to like the 3rd punch it just gets locked on attacking and i cant seem to fix it (also hitbox is at 0,0,0
fixed it by removing the task.wait just above hitbox start
you're a lifesaver dude thanks
can can i take away the slowness when i do all the punches
Hey, nothing personal, the video is great but could you make your mic louder...
This is perfect, can I use this in a future game?
yeah why not
@@SushiMasterOfficial Thanks! Going to start on this when I get animations done!
Hey! Great tutorial. Everything works perfectly except my animations play in the wrong order. They are all set to action priority and are numbered in the order I want. The 5 plays first for some reason. If you have an answer lmk!
you need to place them in ReplicatedStorage.punch anims and then place them as you want them to load, for example i have anims 1 2 3 4 5, i will place them in folder in this way: 1 4 2 3 5 and my anims will be showed as 1 4 2 3 5
Anyone know how to fix ServerStorage.Modules.MuchachoHitboxV1.1:407: attempt to index nil with 'Key'?
and ServerStorage.Modules.MuchachoHitboxV1.1:424: attempt to index nil with '_clear'
after 2 hits it just stops and outputs error tried to call missing method 'start' on table
Does the combo work for mobile?
no but watch the last video he make Video Suport The Mobile Users!