How to Make a Knockback Attack Script | Roblox Studio Tutorial

Поделиться
HTML-код
  • Опубликовано: 12 сен 2024

Комментарии • 134

  • @MajesticUC
    @MajesticUC  Год назад +5

    Like and Sub! Tell me what tutorial I should make next!!!

    • @LostLoserHero
      @LostLoserHero Год назад +3

      Particle effects

    • @DiseasedChicken
      @DiseasedChicken Год назад +3

      Make Stun PLEASE! I NEED IT!!!!

    • @eitanlify7390
      @eitanlify7390 Год назад

      question, how can I make the knock back on the 5th hit

    • @MajesticUC
      @MajesticUC  Год назад

      The knockback is the final parameter of the remote event. Just add 2 more else ifs and then increase the knock back on the final punch

    • @SamJacob6
      @SamJacob6 Год назад +2

      Hey can u help it won't work no errors in output or nothing I don't what's happened I have check and it's the same do u know how I could fix I have tried everything??

  • @chessbrahh2068
    @chessbrahh2068 4 месяца назад +2

    this worked very well for me. i already had my own damage code, so i simply pasted the knockback() function into my scripts and made sure i was calling it correctly. thank you!

    • @user-cd5nz2pz6f
      @user-cd5nz2pz6f 4 месяца назад +1

      Yo rlly quick can you tell me which bit you pasted

    • @chessbrahh2068
      @chessbrahh2068 4 месяца назад

      @@user-cd5nz2pz6f
      sure - just call this function whenever an enemy gets hit. it's all you need. (make will need to tweak 2 of the lines, so that they refer to whatever your enemy and player variables are named)
      --this knocks the ENEMY back, not a player
      function knockback()

      --local power = math.random(0,75)
      local power = math.random(0,50)

      --this should refer to the enemy humanoid root part (you might need to tweak this line)
      local ehrp = model.HumanoidRootPart

      --this should refer to the player who hit the enemy (you might need to tweak this line)
      local plyr = game.Players[configs.creator.Value]

      --print("the player who hit me was " .. plyr.Name)

      local uhrp = plyr.Character.HumanoidRootPart
      local att = Instance.new("Attachment", ehrp)
      local lv = Instance.new("LinearVelocity", att)
      lv.MaxForce = 9999999
      lv.Attachment0 = att
      local lookVector = uhrp.CFrame.LookVector
      lv.VectorVelocity = lookVector * power
      local tween = ts:Create(lv, kbtween, {VectorVelocity = lookVector * 0.1})
      tween:Play()
      game.Debris:AddItem(att, 0.3)
      end

  • @goldenbandito4069
    @goldenbandito4069 Год назад +5

    Your tutorials are pretty useful , thank you ! Keep going

  • @boogamer1909
    @boogamer1909 Год назад +3

    Thanks, your videos are really helpfull, i belive you will have sucess if you keep doing this :D (sorry if im using bad grammar, im from brasil lol)

  • @leofluffbun
    @leofluffbun Год назад +2

    Just a note, client hitboxes can be easily expoilted a good tip is to add checks if you are doing client hitboxes or just do server hitboxes.

    • @sairentokir5060
      @sairentokir5060 Год назад

      Thank u so much!

    • @leofluffbun
      @leofluffbun 9 месяцев назад

      @@zenikui so you see how in that script mostly from this it sends 'size' exploiters can just do this game.ReplicatedStorage.Events.Hitbox:FireServer(vector3.new(2048,2048,2048),vector3.new(3),math.huge(),999) client should not have the power to set hitbox size or the damage, things like that should be handled on server as well as having hitbox summon on server yeah you might get delays in the hit but it's more secure. most checks i would say for this code would be checks to see if size is too big and if the player is in range of the person casting the hitbox like using like a magintue of how far in front of player's character the hitbox should activate damage/knockback as well as a check for damage so expoilters can't just do inf damage. No offense to the creator at all just wanting to be well helpful

  • @propergato
    @propergato Год назад +2

    thank you man
    u earned a sub and a like :)

  • @veyzraRBLX
    @veyzraRBLX Год назад

    I think you are my new favorite roblox dev youtuber!

  • @50FiftyKaliber
    @50FiftyKaliber Год назад

    Nice Video, I Subscribed!

    • @50FiftyKaliber
      @50FiftyKaliber Год назад

      Could you make more in-depth tutorials in the future? I would deeply appreciate it and your work inspires/fascinates me!

  • @Just_jaklol
    @Just_jaklol Год назад +2

    Can u do one on stunning or air combos pls keep it up btw

    • @MajesticUC
      @MajesticUC  Год назад +2

      Yeah Definitely!

    • @Just_jaklol
      @Just_jaklol Год назад +1

      ​@@MajesticUC tysm ❤

    • @propergato
      @propergato Год назад

      @@MajesticUCStun would be great (air combos to)

  • @mongobongo6654
    @mongobongo6654 3 месяца назад

    hello :D i rly like your videos about coding. many other devs just skipping entire code to make video not very long. tysm for that! but the thing is when at 2:10 you were making knockback, on video it was sliding to position where it stops going , but for me i just almost tp there (it not tp at all, it going there very fast it looks like it tp) pls say what it can be im confused :( ty :)

  • @user-om5wq4nv3x
    @user-om5wq4nv3x Год назад +2

    You shouldn’t be using .Touched, instead use overlap perams or get parts in part.

  • @PsycSkiller
    @PsycSkiller Год назад

    Good Work!! frfr

  • @SamJacob6
    @SamJacob6 Год назад +2

    Hey Dev can u help I have done everything right double check but I dosent work I have checked in output nothing wrong check in vid and it's the exact same do u know what's happening if so can u help?

  • @Harold2141
    @Harold2141 Год назад +2

    how would i add a animation to knowckback and also how do i add sounds to the punches

  • @DiseasedChicken
    @DiseasedChicken Год назад +2

    PLS MAKE STUN TUTORIAL!!!!

  • @RipXy3rx
    @RipXy3rx 2 месяца назад

    To add damage you need to go to hitbox script, go to line 33 and add another line and type in the new line "local damage = Your damage

  • @1nsanity_
    @1nsanity_ Год назад

    This is such a great tutorial! And can you do a particle tutorial

  • @GlitchedHunter16
    @GlitchedHunter16 Месяц назад

    You should make a tutorial on how to add stun to the punches

  • @Diamondplayz-hu9he
    @Diamondplayz-hu9he Год назад

    Could make a tutorial on how to add a animation when the dummy is hit. Also keep your vids going, there great!

  • @usercoocoocrazy293
    @usercoocoocrazy293 11 месяцев назад

    this is good for me cuz i cant really code but can animate really well

  • @lucas8744
    @lucas8744 Год назад +1

    tysm it worked

  • @rundro4808
    @rundro4808 Год назад

    i can learn from this, thanks a lot 👍

  • @kelvincoemsfactory
    @kelvincoemsfactory Год назад

    You earned a sub

  • @1VRRR
    @1VRRR Год назад +3

    When new dev LOGG?????????????

    • @MajesticUC
      @MajesticUC  Год назад +1

      I have been away for a while. It should come out by next week or the week after!

  • @airwaym3973
    @airwaym3973 Год назад +2

    next devlog when

    • @MajesticUC
      @MajesticUC  Год назад +3

      I've been away for a few days now but I'm finally back! Should come out either this week or next week 🤷

    • @propergato
      @propergato Год назад +1

      @@MajesticUC yay

  • @limitednoob9521
    @limitednoob9521 Год назад +1

    hey can you make an animation for the 3 part and do it so that you get cash
    when it dies and so it will respawn

  • @ragnability4232
    @ragnability4232 3 месяца назад +2

    I tried this, though the knockback is jittering and laggy for some reason..

    • @MajesticUC
      @MajesticUC  3 месяца назад

      That jittery thing will not happen in an actual game. Im assuming you’re testing on a dummy. The jitter is when the dummy moves out of your network ownership so it shouldnt happen in an actual game

  • @ankhangnguyen7848
    @ankhangnguyen7848 Год назад +1

    hey can u make a video about the hit stun and the stun u will recieve when m1 or the one who get m1ed?

  • @sadeceturkiye.
    @sadeceturkiye. Год назад +1

    Please do q to dash

  • @mickieani1160
    @mickieani1160 Год назад

    This works way too well
    Here are some ideas:
    • The person who takes damage is animated and has stun
    • Ability with toolbar GUI that displays cooldown(I didn’t understand it during the dev log you made)

    • @codenomad.
      @codenomad. 11 месяцев назад +2

      For the first step, you can simply add an animation by accessing the hit.Humanoid.Animator within the damage script, and then load the animation onto the character. For the stun effect, use a separate script (which should be disabled by default) within the main script. In the damage section of the main script, create a function in the 'stunhandler' script that disconnects the player's keyboard input from the game, allowing them only to control the camera. After a certain duration, this 'stunhandler' script should be removed. To achieve this, you can make the 'stunhandler' script clone itself onto the hit.Character or a similar target.
      Sorry if you couldn't understand me, my english is bad, im trying to learn.

  • @sebastianbramborak2756
    @sebastianbramborak2756 Год назад

    Could you please do tutorial how to apply Stun after last punch in combo and how to add stun animation?

  • @yuarlel
    @yuarlel Год назад

    Hey could you possibly tell how to make sfx with it or include sounds when they get hit, or animation when they got hit?

  • @50FiftyKaliber
    @50FiftyKaliber Год назад +1

    For The Next Tutorial, Can You Teach How To Add Particles To The Punches? I Got Stuck After Successfully Adding SFX Myself.

    • @Diamondplayz-hu9he
      @Diamondplayz-hu9he Год назад

      I agree, that could really help :D

    • @codenomad.
      @codenomad. 11 месяцев назад

      If ya'll still stuck, just add a function in the main script that creates ParticleEmitters in the character hands, then, when the player clicks these particles will emit (you can use, for example:
      local particle = Instance.new("ParticleEmitter")
      particle.Parent = Character:WaitForChild("RightArm")
      --here should be the damage part that handles most of the script
      particle:Emit(50) -- change the number if you want, its just an example

  • @frostberry
    @frostberry 10 месяцев назад

    I have followed the Tutorial to the Tea and I have even copied from the pastebins and yet the knockback seems to be laggy, almost like the tween isn't working

  • @MajorLightning
    @MajorLightning 4 месяца назад

    Wait can you add this to a ragdoll script? If you can, then how?

  • @vincentorz4014
    @vincentorz4014 Год назад +1

    whats that opening sound effect :o

  • @alyha_7938
    @alyha_7938 Год назад

    i made it so i have 5 punches but it says if kb

  • @Burgeregg64
    @Burgeregg64 Год назад

    hey just wondering if you could make a stun tutorial thank you.

  • @wasdwar4egregsgsfdgrsdfgsreg
    @wasdwar4egregsgsfdgrsdfgsreg Год назад

    can you make another part that shows how to add vfx and make separate attacks

  • @trxlly
    @trxlly 10 месяцев назад

    THNXX

  • @Waltr_Black
    @Waltr_Black 6 месяцев назад

    how can i make the player ragdoll when he gets knockback?

  • @Pr028
    @Pr028 Год назад

    can u make a tutorial showing us how to use particles and SFX?

  • @cudr_
    @cudr_ 11 месяцев назад

    my knockback is laggy it kinda just teleports the player it hits

  • @Peaceful_Bacon
    @Peaceful_Bacon Год назад +1

    Its not working :(

  • @SinanEmin-oq5gd
    @SinanEmin-oq5gd Месяц назад

    Uhh mine doesnt do knock back

  • @Too_Chaotic_Too_Good
    @Too_Chaotic_Too_Good Год назад

    Very cool thanks! anything i could add to make them fling up a bit?

    • @MajesticUC
      @MajesticUC  Год назад

      Yes you could. You could fire the knockback parameter as a vector 2 in the local script. Then in the server script inside of the knockback function you can do lv.VectorVelocity = uhrp.Cframe.LookVector * power.X + Vector3.new(0, power.Y, 0)

    • @Hehelol3321
      @Hehelol3321 Год назад

      @@MajesticUC where do I start it? At local lookvector or lv.Vector velocity?

    • @MajesticUC
      @MajesticUC  Год назад

      @@Hehelol3321 start what?

    • @Hehelol3321
      @Hehelol3321 Год назад

      @@MajesticUC at waht point do I write it?

    • @MajesticUC
      @MajesticUC  Год назад

      @@Hehelol3321 write what

  • @Mucheirp
    @Mucheirp Год назад

    you can make plz part 3 it giving sounds

  • @kelvincoemsfactory
    @kelvincoemsfactory Год назад

    Can you make knockback physics

  • @rodzigo
    @rodzigo Год назад

    Please make a stun tut!

  • @jingboss1234
    @jingboss1234 Год назад

    hey man can u make downslam and uppercut?

  • @TheRealTiger0
    @TheRealTiger0 8 месяцев назад

    how do I make it do knockback every hit? EDIT: nvm i found out how to do it

  • @AlanJohn-r2h
    @AlanJohn-r2h Год назад +1

    0:24 how can an ai voice have voicecrack !?!?!

  • @doiyoboiyo
    @doiyoboiyo Год назад +1

    is it possible to make them ragdoll after they get hit

  • @CryosMC
    @CryosMC Год назад

    can you make a fireball for r6?

  • @The_Orb
    @The_Orb Год назад +1

    how do i change the damage of the punch?

    • @MajesticUC
      @MajesticUC  Год назад

      in the hitbox function there is a parameter for damage. Just change that

    • @alexiz_bs
      @alexiz_bs 9 месяцев назад

      heyyy its not working :(@@MajesticUC

  • @AFloppyStick
    @AFloppyStick 2 месяца назад

    hey can you fix this uhh error " ServerScriptService.Script:58: attempt to compare nil

  • @lb_anth0ny240
    @lb_anth0ny240 Год назад

    Everything works fine for me but it looks a bit laggy for some reason, I tested it in game (not in studio) to check if it was a studio issue but it wasnt. The only difference between mine and yours is that the script is stored on the server. It also can't be my pc lagging cuz it doesnt have issues on other games at all, roblox included.
    If you or anyone could help me out I would really appreciate it.
    edit: (just realized yours is also stored on the server)

    • @MajesticUC
      @MajesticUC  Год назад

      Well it rlly depends on how you’ve made the knockback. In the game im making rn, I use body velocity which isnt what i used in this video. Perhaps try using bodyvelocity or linear velocity instead for your knockback

    • @lb_anth0ny240
      @lb_anth0ny240 Год назад

      @@MajesticUC I did the exact same knockback as you (linear velocity), using pretty much the same code
      edit: I figured out what was making it laggy, line that rotates the enemy towards the attacking player. But do you know how to get that effect in another way?
      function KnockBack(pHrp, eHrp, power)
      local att = Instance.new("Attachment", eHrp)
      local lv = Instance.new("LinearVelocity", att)

      lv.MaxForce = 999999
      lv.Attachment0 = att
      lv.VectorVelocity = pHrp.CFrame.LookVector * power
      / / / Thats the rotation thing \ \ \
      eHrp.CFrame = (pHrp.CFrame - pHrp.CFrame.Position + eHrp.CFrame.Position) * CFrame.Angles(0, math.rad(180), 0)

      game.Debris:AddItem(att, 0.2)
      end

    • @MajesticUC
      @MajesticUC  Год назад

      Idk if I can help then. Mine isnt laggy at all. Sorry I cant help 😢

    • @lb_anth0ny240
      @lb_anth0ny240 Год назад

      @@MajesticUC With my latest changes it seems like when a second player joins in is when the knockback is laggy.
      Could you try to launch a local server with 2 players to see if the knockback becomes laggy, if you could it would be very very appreciated! 🙏

  • @엘에스쥐
    @엘에스쥐 Месяц назад

    How to ragdoll?

  • @user-iw1bm8pp9h
    @user-iw1bm8pp9h Год назад

    pls show how to add ragdoll to it

  • @fkn_ant
    @fkn_ant Год назад

    Is it possible to change the direction of knockback like upwards?

    • @Stickdraws
      @Stickdraws Год назад

      Yes

    • @fkn_ant
      @fkn_ant Год назад

      yea i figured it out lol but amzing response very helpful 9/10 @@Stickdraws

    • @Stickdraws
      @Stickdraws Год назад

      @@fkn_ant lol I didn’t know how tho sorry

  • @AkumuPiano
    @AkumuPiano Год назад

    can you make a damage blocking guide?

  • @blequ145
    @blequ145 Год назад

    How to add sound on punch?

    • @Maximdoesslapbattles
      @Maximdoesslapbattles 6 месяцев назад

      I think that after one of the hits in the non velocity script add a sound and then after the attack play the sound.

  • @Rmaniae
    @Rmaniae Год назад

    can u do kicking next

    • @LostLoserHero
      @LostLoserHero Год назад

      i think that for kicking you can just change the animation for a kicking animation

    • @MajesticUC
      @MajesticUC  Год назад

      @@LostLoserHero yup

    • @Rmaniae
      @Rmaniae Год назад

      @@LostLoserHero nope and the hit box aswll as how it would effect you when u were hit🤨

  • @Rmaniae
    @Rmaniae Год назад

    i wanted to start with sorry but aswell as sorry if its ok even the what i said was horrible to you i was wondering if you could mabye help work on a project with me if not you can so no and say something as rude as i did last time just cause it didnt work for me☹️

    • @Rmaniae
      @Rmaniae Год назад

      is that a yes or no