How To Make Battlegrounds Combat System Part1 (Roblox Studio)
ฝัง
- เผยแพร่เมื่อ 25 ส.ค. 2024
- How To Make Battlegrounds Combat System Part1 (Roblox Studio)
This is the first part of the tutorial
I'll explain how to make a battlegrounds combat system
/\*/\*/\*/\*/\*/\*/\*/\*/\*/\*/\*/\*/\*/\
Tomato Hitbox Module: www.roblox.com...
CombatServer: pastebin.com/W...
Main: pastebin.com/e...
CombatClient: pastebin.com/p...
Join my Discord Server (Cus why not 🤷♂️)
Discord: / discord
Same with my roblox group:
Group: www.roblox.com...
\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/*\/
Props to this guy, I watched the entire vid and I dont even have Roblox studio. He made a tutorial that’s informative and entertaining
@@g0joshortsyou need to train text interpretation, and I don't even speak English.
@@Nalticobasically he’s saying when you get roblox studio, you have to log in through the studio and create a game.
@@IAmJuniorJuniorIsLifeYeah that’s the idea 🤔
corny levels dangerously high, termination reccomended
Bro just you in Mobile
"whats your special talent?"
"typing in light speed."
What did you missed? Him editing the speed
💀
looks like you don't know editing
AHHAHAHA
just slow the video speed and ur good 🦕🦕
Thank you so much bro im working on a battleground game right now and this is helping me out A LOT
No problem 👍
SAME
SAME BOOBOOBEAR
is it dxd battlegrounds?
Bro where are the folders 😭
I just found out, if you don't have moon animator, and your using the normal animator, rename the key frames to "Hit" instead of creating a animation event. That's what i did and it worked
what keyframes?
@@bruhwhosjustin1790 the key frame right before the punch
in what folder?
sir i need help doing a combat system could you help me? if yes pls help me. also a saturo fan btw
How do u rename?
Finally I understand animations events, and they’re just what I need! Amazing tut man, earned a sub for sure!
yo how to create the animation event thing
left click and press insert object then select 'animation' or 'animator' or whatever you need@@stanleymiles2693
M2 click on the area where you put the key frame and click on "add event on here" or something like that
Bro your tutorials are so detailed and simple. Instead of me just copying what you do i review the things you did so i can apply them And learn from those things, You earned a sub from me
Same!
Damn man, I couldn't figure why the animations were not playing for my friend, and you just solved my problem casually. Thanks!
thats a kinda funny glitch that happens with roblox, Animation is private, if it continues, consider playing offline animations
THIS TUTORIAL IS GREAT! one thing is, guys.. dont give up the first time u get an error, watch the video to the end and keep trying and testing things till it works
the thing is i dont even get errors
@@aaaeebaaeeSame plus I speant two hours on this and it did NOTHING
for me it says "attempt to index nil with 'WaitForChild' "
like is the script it self the problem?
@@Thedudemandudemandude because you are dumb :/
@@jacksonsalles4078 no, you gotta be more specific dude, whats the full error
thank you! i am creating a game. ive made a punch animation and other things. i recommend using 120 fps for the punches so they are faster!
overall i love this tutorial
why doesnt it work?
What’s the matter
@@Iraqi_samurai so basically i used the script like he told me and other shit and when i tried it didnt work like wtf
@@Car_demon87you didn’t copy something right
You probably had it under a “normal script” instead of “local script”
Yes
Make it that when you use m1s,you get slower like in all of battlegrounds games.
This video is also entertaining,not only informative.
I would look at a sprint script and see how that works then apply is so then if an animation is playing the playerSpeed would equal to ur new value, pudeocode would be this:
defaultSpeed = 1000 // 1000 is just an example, this will also be ur actual speed
baseSpeed = deafultSpeed
slowSpeed = defaultSpeed * 0.2 // 0.2 is also just an example
if animation is playing then
defaultSpeed = slowSpeed
else
defaultSpeed = baseSpeed
end
ayo, very fire video man! Keep up the good work :]
I was here before 100 views. I know, this video will be kinda popular. So im old tomato’s fan!
Me too
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local userInputService = game:GetService("UserInputService")
local dashDistance = 50
local dashCooldown = 1
local lastDash = 0
local function dash(direction)
if tick() • lastDash >= dashCooldown then
local rootPart = character:WaitForChild("HumanoidRootPart")
local dashVector = rootPart.CFrame.LookVector * direction.Z + rootPart.CFrame.RightVector * direction.X
rootPart.Velocity = dashVector * dashDistance
lastDash = tick()
end
end
userInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.W then
dash(Vector3.new(0, 0, -1))
elseif input.KeyCode == Enum.KeyCode.S then
dash(Vector3.new(0, 0, 1))
elseif input.KeyCode == Enum.KeyCode.A then
dash(Vector3.new(-1, 0, 0))
elseif input.KeyCode == Enum.KeyCode.D then
dash(Vector3.new(1, 0, 0))
end
end)
So satisfying watching somebody code
goated vid it helped me so much for my game
For those of you who want the character to slow down while punching, here is my modified CombatServer script that does exactly that:
local rp = game:GetService("ReplicatedStorage")
local remotes = rp:WaitForChild("Remotes")
local animations = rp:WaitForChild("Animations")
local punchRemote = remotes:WaitForChild("Punch")
local ss = game:GetService("ServerStorage")
local modules = ss:WaitForChild("Modules")
local TomatoHitbox = require(modules:WaitForChild("TomatoHitbox"))
local MAX_COMBO = 4
local function changeCombo(char)
local combo = char:GetAttribute("Combo")
if combo >= MAX_COMBO then
char:SetAttribute("Combo",1)
else
char:SetAttribute("Combo",combo + 1)
end
end
local function getPunchAnim(char)
local combo = char:GetAttribute("Combo")
local punchAnims = animations:WaitForChild("Combat"):GetChildren()
local currAnim = punchAnims[combo]
return currAnim
end
local function stopAnims(object)
for i,v in pairs(object:GetPlayingAnimationTracks()) do
v:Stop()
end
end
punchRemote.OnServerEvent:Connect(function(player)
local char = player.Character
local hum = char:WaitForChild("Humanoid")
local humRp = char:WaitForChild("HumanoidRootPart")
local attacking = char:GetAttribute("Attacking")
local punching = char:GetAttribute("Punch")
if attacking or punching then return end
char:SetAttribute("Attacking",true)
char:SetAttribute("Punch",true)
changeCombo(char)
stopAnims(hum)
hum.WalkSpeed = 8 -- THIS IS A LINE I ADDED
local newHitbox = TomatoHitbox.new()
newHitbox.Size = Vector3.new(4.5, 5, 4)
newHitbox.CFrame = humRp
newHitbox.Offset = CFrame.new(0,0,-1.5)
newHitbox.onTouch = function(enemyHum)
if enemyHum ~= hum then
enemyHum:TakeDamage(10)
end
end
local playPunchAnim = hum:LoadAnimation(getPunchAnim(char))
playPunchAnim.KeyframeReached:Connect(function(kf)
if kf == "Hit" then
char:SetAttribute("Attacking",false)
task.spawn(function()
hum.WalkSpeed = 15 -- THIS IS ANOTHER LINE I ADDED
newHitbox:Start()
task.wait(0.1)
newHitbox:Stop()
newHitbox:Destroy()
end)
if char:GetAttribute("Combo") == MAX_COMBO then
task.wait(1)
end
char:SetAttribute("Punch",false)
end
end)
playPunchAnim:Play()
end)
Enjoy :)
thanks dude
@@choFu31 no problem!
my character is not able to punch, idk why tho
@@sqi_d
you need to create animation@@dejv9427
Infinite yield possible on 'ServerStorage:WaitForChild("Modules")' , how to fix this problem?
I like how u scripted it step by step as if you were a beginner, forgetting steps before making it work completely. This explains why it doesn't work and not just giving answers. Best scripting tut vid I've seen in years tbh good job.
can someone help me, i did the script and stuff but It Still Only Plays 1 animation
me too
very understandable and helpfull! Tysm
i cant punch
Try using your hands
@@crusader_gaming8273😂😂😂
@crusader_gaming8273 LOL
@@crusader_gaming8273 try using your brain
@@Rel_ytOHHHHHHHHH
So if you arent using moon animator what should you do instead of the animation event im guessing just rename the keyframe where the punch is at its farthest point
How to I rename
i think almost every animator has the event thing, unless you're doing it outside roblox studio
Man bro your amazing,I can’t even animate but now I’ll try, thanks
beautiful. peak art. unbearably incredible.
if you dont want the character to still walk at a normal speed while punching use this modified CombatClient:
local rp = game:GetService("ReplicatedStorage")
local remotes = rp:WaitForChild("Remotes")
local animations = rp:WaitForChild("Animations")
local punchRemote = remotes:WaitForChild("Punch")
local ss = game:GetService("ServerStorage")
local modules = ss:WaitForChild("Modules")
local TomatoHitbox = require(modules:WaitForChild("TomatoHitbox"))
local MAX_COMBO = 4
local function changeCombo(char)
local combo = char:GetAttribute("Combo")
if combo >= MAX_COMBO then
char:SetAttribute("Combo",1)
else
char:SetAttribute("Combo",combo + 1)
end
end
local function getPunchAnim(char)
local combo = char:GetAttribute("Combo")
local punchAnims = animations:WaitForChild("Combat"):GetChildren()
local currAnim = punchAnims[combo]
return currAnim
end
local function stopAnims(object)
for i,v in pairs(object:GetPlayingAnimationTracks()) do
v:Stop()
end
end
punchRemote.OnServerEvent:Connect(function(player)
local char = player.Character
local hum = char:WaitForChild("Humanoid")
local humRp = char:WaitForChild("HumanoidRootPart")
local attacking = char:GetAttribute("Attacking")
local punching = char:GetAttribute("Punch")
if attacking or punching then
char.Humanoid.WalkSpeed = 4
wait(0.5)
char.Humanoid.WalkSpeed = 16
end
if attacking or punching then return end
char:SetAttribute("Attacking",true)
char:SetAttribute("Punch",true)
changeCombo(char)
stopAnims(hum)
local newHitbox = TomatoHitbox.new()
newHitbox.Size = Vector3.new(6,6,6)
newHitbox.CFrame = humRp
newHitbox.Offset = CFrame.new(0,0,-2.5)
newHitbox.onTouch = function(enemyHum)
if enemyHum ~= hum then
enemyHum:TakeDamage(10)
end
end
local playPunchAnim = hum:LoadAnimation(getPunchAnim(char))
playPunchAnim.KeyframeReached:Connect(function(kf)
if kf == "Hit" then
char:SetAttribute("Attacking",false)
task.spawn(function()
newHitbox:Start()
task.wait(0.1)
newHitbox:Stop()
newHitbox:Destroy()
end)
if char:GetAttribute("Combo") == MAX_COMBO then
task.wait(1)
end
char:SetAttribute("Punch",false)
end
end)
playPunchAnim:Play()
end)
Im pretty sure thats combat server?
why is it so delayed
Hey, i got a question for you, how did you reflect the animation 1 and 2?
moon animator has it
@@Yeblen whats the keybind
@@TLWM111 control r
@@randoAnim I already know it now, But thanks mate
You saved alot of my time. Thanks for your hitbox system.
Been working on using python to write games and before that course started i was confused on what was being said on the vid. Now I fully understand some of the aspects of the code. While not all of them (like the child commands) I can sort of interpret the code for roblox as python code. Both have very similar properties, just some writing differences.
hey I need help I'm getting the error "Infinite yield possible on 'ReplicatedStorage:WaitForChild("Remotes")" what can I do to fix this?
you spelt the Remotes folder wrong
@@floppasayshi no its spelled right i have the same issue but its with module
you probably already fixed this but when I fixed it I felt pretty stupid. I put the Remotes folder inside of the Animations folder instead of ReplicatedStorage, and when I put the Remotes folder into ReplicatedStorage it worked.
@@1LightZ7 then the folder is on wrong location
@@floppasayshi very helpful -_-
Hey! I have followed this script almost entirely one to one, but for some reason whenever I start punching the error "ServerStorage.Modules.TomatoHitbox:159: attempt to call missing method '_Visualize' of table" floods my output repeatedly, and eventually causes massive lag to start building up. I also don't deal damage to the dummy at all. Any help would be greatly appreciated!
Send your server script
same
i hvanet watched the tutorial yet but i see that it says "TomatoHitbox" and the youtuber who made this tutorial´s name is... The Tomato, so im guessing if your roblox name isnt Tomato or something(but the youtubers rblx acc name would probably be) then i think in that part of the video youre supposed to write, like something else, maybe your username. But im not good in scripting language and i havent watched the tutorial yet so this is unlikely.
@@JozinZeBazin Yeah that's not the problem. TomatoHitbox is just the name of the module, it has no connections to any username
@@pulograinhey I need help, when I put animations on the 20th scetence on combat server it says “unknown global user”
GREAT VIDEO KEEP UP THE WORK!
I made a little animation and a code here but my punches aren't doing any damage and they're all coming out at the same time. And i used this tutorial
can someone help?
i copy the code from the link but it still doesnt work.
i have r6 and the animation setting on standard
PLEASE HELP
Same
still nobody knows how to fix it?@@fiolet_shmonya
i also have this trouble Touched is not a valid member of Model "Workspace.Model.Model".
i did absoulutely all right..
what error are you getting
ok so idk how but i made it work!!!!!!!!
all i need now is just a slower cooldown
@@Mrwoof_tophat HOOOOOOOOWWWW
tomato can you please make it a public model so we can use it right away it would be really helpful
thanks.
Lazy.
dawg you still need to spoof/make the animations yourself also its a tutorial to make your own battlegrounds not steal your own battlegrounds game
VERY GOOD ANIMATION I JUST LOVE IT🤩
It wasnt repeating but turns out in one of them i forgot to make an event and now it works :D
I can only activate the first hit and it doesn't work again.
Forget it, I realized I forgot to put an event in the animation and now it works.
BRO TYYYY VERY MUCH YOU JUST SAVING MY PROJECT'S LIFE
GUYS HOW DO U ADD ANIMATION EVENT?
this is the best feedback tysm
Ty man now my and my friend can develop our battlegrounds game
1 creator + not understand = pain learning but it helpful thanks tomato
YESSSS TYSM NOW I CAN DO COMBAT SYSTEM IN MY GAME!!!!!!!
for some reason it doesnt work for me....
i used normal roblox animator
The song hits like it’s a very good song
Thank you this helped a lot
Helps a lot thanks
Thank you so much bro I’m making my own battlegrounds game and thank you for helping us make it our game will be called color battlegrounds
I made all the punching animations before watching this and now have to redo all of them. : (
It is too basic scripting, the system is basic and efficient, it is good for players who want to become true developers, a very useful video!
what do i do when this eror pops up Infinite yield possible on 'ServerStorage:WaitForChild("Modules")'
same problem 😭😭😭😭
😭😭😭😭😭😭😭😭@@Sansicmp
@@UTENSILS483 I found out why, u gotta go through the whole vid and add hitbox 😭
thank you so much im creating alot today.
Can you do a part 3 for abilities and adding new characters?
I copy everything exactly the same and i got like 8 Errors! 😭
Not even 1 punch animation is going through 😭
Thanks bro i think im gonna make m'y battleground but only for me and m'y Friend so i Can add their own attack
Thanks
Bro i just COPIED all the scripts but combat system dont working((
okay so i followed all the directions... i click the game... i click... nothing happens :/
Question. What do I do if when I put in the Line of code that makes it so you can punch more It stops Punching?
ty, im gonna make an bg game with my friend, tysm
You got yourself a new subscriber
Thanks for this.
to make it more faster with the animation drag the keyframes more closer to echother
Thx now ican make my sandbox/battlegrounds
i did this tutuorial and for some reason my punches only come once. Then when im done my 4th punch, i mcant punch anymore
THANK YOU SO MUCHH ITS WORKING
Hi, this doesn't work.
My character only deals 1 hit and that's it.
thank you Bro (works for me)
u guys have to turn on "Enable Studio acces to API service"
can you PLEASE make it so the pastebin scripts have the finished result. because the main doesnt have the saem script as in the video.
8:32 personal stamp
local rp = game:GetService("ReplicatedStorage")
local remotes = rp:WaitForChild("Remotes")
local animations = rp:WaitForChild("Animations")
local punchRemote = remotes:WaitForChild("Punch")
local ss = game:GetService("ServerStorage")
local modules = ss:WaitForChild("Modules")
local TomatoHitbox = require(modules:WaitForChild("TomatoHitbox"))
local MAX_COMBO = 4
local function changeCombo(char)
local combo = char:GetAttribute("Combo")
if combo >= MAX_COMBO then
char:SetAttribute("Combo",1)
else
char:SetAttribute("Combo",combo + 1)
end
end
local function getPunchAnim(char)
local combo = char:GetAttribute("Combo")
local punchAnims = animations:WaitForChild("Combat"):GetChildren()
local currAnim = punchAnims[combo]
return currAnim
end
local function stopAnims(object)
for i,v in pairs(object:GetPlayingAnimationTracks()) do
v:Stop()
end
end
punchRemote.OnServerEvent:Connect(function(player)
local char = player.Character
local hum = char:WaitForChild("Humanoid")
local humRp = char:WaitForChild("HumanoidRootPart")
local attacking = char:GetAttribute("Attacking")
local punching = char:GetAttribute("Punch")
if attacking or punching then return end
char:SetAttribute("Attacking",true)
char:SetAttribute("Punch",true)
changeCombo(char)
stopAnims(hum)
hum.WalkSpeed = 8 -- THIS IS A LINE I ADDED
local newHitbox = TomatoHitbox.new()
newHitbox.Size = Vector3.new(4.5, 5, 4)
newHitbox.CFrame = humRp
newHitbox.Offset = CFrame.new(0,0,-1.5)
newHitbox.onTouch = function(enemyHum)
if enemyHum ~= hum then
enemyHum:TakeDamage(10)
end
end
local playPunchAnim = hum:LoadAnimation(getPunchAnim(char))
playPunchAnim.KeyframeReached:Connect(function(kf)
if kf == "Hit" then
char:SetAttribute("Attacking",false)
task.spawn(function()
hum.WalkSpeed = 15 -- THIS IS ANOTHER LINE I ADDED
newHitbox:Start()
task.wait(0.1)
newHitbox:Stop()
newHitbox:Destroy()
end)
if char:GetAttribute("Combo") == MAX_COMBO then
task.wait(1)
end
char:SetAttribute("Punch",false)
end
end)
playPunchAnim:Play()
end)
i don’t like how all battlegrounds games put so little effort into simple punch and kick anims, and i know the animators might not want to do them but seriously, i want a different battlegrounds game that has quality content and has a good community
how u move hand btw? i cant move it
while animating click R
I got a slight problem any help I'd appreciate but for some reason I can't punch I set it to R6 I put in the scripts and stuff can anyone help out?
What button do press to punch
nice
thanks btw i rilly wanted to make this
It doesn't help me, it just gives me a blow that doesn't hurt, and I already checked and I don't know what to do, IT'S NOT WORKING FOR ME, I've tried everything, help me ;-; I already copied it practically the same, help
How did you make the 2nd punch mirror like that?
HOW TO DID EVENT ON BASIC ROBLOX ANIMATION
Tanks bro, i love you
How to do it on Roblox animation
if you are using the roblox editor, how do you 'export' the animation?
Publish to Roblox
markerreached is the new way i think to do animation events
it doesnt play a animation for me and it says Infinite yield possible on 'ServerStorage:WaitForChild("Modules")' Can you guys help or I'm going to put a firework to my head and set it off
SAME
For some reason whenever i click it doesnt swing or do an animation and im pretty sure i followed all the steps
deserves a like:) i can only hit once tho but deserves a like
Thanks cause i wanna make a battlegrounds game similar to transformers:))
Help My Animations are not working
FINE!
idk why, but i can do only one punch, despite the fact that i have full script
im too!
Can you make a simple one for beginners because this one is way too hard for me as I just starting scripting roblox studio this year
why can i only hit once and the hitbox doesnt even show up
we don’t have a moon animator
Guys! I need help, when I put animations on the 20th scetence on combat server it says “unknown global user”
Does anyone know why mine only knocks once?
Me too bruh 😭
im getting an error called "Infinite yield possible on 'ServerStorage:WaitForChild("Modules")'
create a folder named Modules and put the module into it
what module
@@bebra3392
i reccomend yall to watch the video in 0.25 speed as the speed is too fast specially in the animations part
Hello! I don't like hitboxes but i like your work, so can you make without hitboxes?
You can do ontouch with the enemyhum
Thx bro
i edited the game in studio and the punching walking dashing and basically any animation doesnt work and i didnt mess with anything i just clicked edit in studio and tried the game and then well the animations didnt work. please fix this thank you and have a good day :)