How to Add Knockback to Attacks (Remake) | Roblox Studio

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ย. 2024

ความคิดเห็น • 126

  • @squakers9950
    @squakers9950 ปีที่แล้ว +5

    So great to have one finally work after watching so many videos, I also love the use of the template and explaining a bit about what each thing does. It actually helped me learn a bit about coding.

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  ปีที่แล้ว

      Nice! I’m glad it was helpful!

    • @squakers9950
      @squakers9950 ปีที่แล้ว

      @@SimTekGameDevelopment Just one question, what would I do to turn a higher amount of knockback into a gamepass?

  • @tacwedie
    @tacwedie 7 หลายเดือนก่อน +2

    Thank you so much. I hate having to research in hundreds of dev forums to know how to do something, and your videos are really simple and easy to understand.

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  7 หลายเดือนก่อน +1

      Aw thanks man!

    • @tacwedie
      @tacwedie 7 หลายเดือนก่อน

      @@SimTekGameDevelopment I have encountered a small problem though.. "Small", I found that if I leave the "* math.huge" in the code, I get banished to the shadow realm (as soon as my character delivers the punch and applies the knockback, I fly past world borders and die in the void), any ways to solve this?

  • @arbitragebetter8584
    @arbitragebetter8584 2 ปีที่แล้ว +2

    Your tutorial saved me from losing a little quality in my attack!
    Thanks so much for doing this! THANKS FOR SIMPLIFYING IT

  • @Erolsaurus
    @Erolsaurus 2 ปีที่แล้ว

    Only looked at the end of your tutorial for the knockback for a joke project, yet it still worked perfectly. 10/10 tutorial!

  • @etstudio5
    @etstudio5 2 ปีที่แล้ว

    dude I just searched this needing it for my game and you just published today. Awesome!

  • @skyless5500
    @skyless5500 ปีที่แล้ว +4

    local rs = game:GetService("ReplicatedStorage") -- place remote event in replicated storage
    local strikeRe = rs:WaitForChild("StrikeRe")
    local hookDamage = 30
    local hookReach = 3
    local hookArea = 2
    -- returns humanoid root part and humanoid if valid character
    local function getHrpAndHumFromChar(char)
    if char then
    local hrp = char:FindFirstChild("HumanoidRootPart")
    local hum = char:FindFirstChild("Humanoid")
    return hrp, hum
    else
    return nil, nil
    end
    end
    -- applies damage if enemy character is within the area of the hit position
    -- player will be needed for kills leaderboard
    local function doDamage(player, enemyChar, hitPos, area, damage)
    local eHrp, eHum = getHrpAndHumFromChar(enemyChar)
    if eHrp and eHum then
    local dist = (hitPos-eHrp.Position).Magnitude
    if dist 0 then
    if strikeType == "Hook" then
    local pos = (hrp.CFrame+hrp.CFrame.LookVector*hookReach).Position
    doStrike(player, pos, hookArea, hookDamage)
    end
    end
    end
    strikeRe.OnServerEvent:Connect(handleStrikeRe)

    • @urlocalepicgamer7179
      @urlocalepicgamer7179 11 หลายเดือนก่อน

      The legend we all needed

    • @skyless5500
      @skyless5500 11 หลายเดือนก่อน

      @@urlocalepicgamer7179 frrrrrrrrrrrr
      thanks for reply

    • @Mist_5
      @Mist_5 3 หลายเดือนก่อน

      Thanks bro

  • @danielkim3525
    @danielkim3525 ปีที่แล้ว

    Very useful video. I was able to use this to introduce knockback on top of projectile damage. Thanks!

  • @MazenAGHS
    @MazenAGHS 2 ปีที่แล้ว +1

    One Of The Most Helpful Video On Your Channel In My Opinion I've Learned ALOT From This Video

    • @Kalyptoisea
      @Kalyptoisea 2 ปีที่แล้ว +1

      how to copy and paste scripts

  • @Mystery984
    @Mystery984 2 ปีที่แล้ว

    I'm gonna try this because, this seems very cool!!

  • @arodingoya8598
    @arodingoya8598 2 ปีที่แล้ว

    this is amazing thank you for making this video

  • @Lightzix
    @Lightzix 2 ปีที่แล้ว

    these combat tutorials really help!!

  • @baconator8859
    @baconator8859 2 ปีที่แล้ว

    Just what I needed thank you 🙏

  • @LprnKy
    @LprnKy ปีที่แล้ว

    thanks a lot, i am making a game (kinda like ability wars but with tools) that helped a lot.

  • @marcuskelly2611
    @marcuskelly2611 ปีที่แล้ว +1

    Why does the npc float into the sky slowly instead of taking knockback??

  • @delvanoelvin
    @delvanoelvin หลายเดือนก่อน

    BodyVelocity is now deprecated, yes it still works but it can cause a lot of error in the future since it's technically outdated

  • @CorruptedBinary
    @CorruptedBinary 2 ปีที่แล้ว +1

    Please Make A tutorial about How to Dodge like sans in Roblox!! I want it for my game!!! I will wait for it :)

  • @PaperGorillaTag
    @PaperGorillaTag ปีที่แล้ว

    can I make it so when I attack a player or npc, they ragdoll on knockback? thanks!

  • @idkk5335
    @idkk5335 2 ปีที่แล้ว

    Can you make a vid on how to make stun too (so for example if you hit someone with a sword they can't move or do anything for like half a sec)? Great vid btw

  • @Mayorascat31
    @Mayorascat31 6 หลายเดือนก่อน

    what do i do if the enemy instead of taking knockback it starts flying away in the same spot? D:

  • @soloxios
    @soloxios ปีที่แล้ว

    Can you show how too make a knockback weapon like a sword?

  • @mak1nlt628
    @mak1nlt628 2 ปีที่แล้ว +2

    Is there a way to make it so that where when pressing a certain keybind you'd do a punch with knockback? I kinda need one and I've been stuck on making one for forever.

  • @burritoiskool
    @burritoiskool 2 ปีที่แล้ว +1

    how to add a cool down?

  • @abdullahmalukzai1
    @abdullahmalukzai1 2 ปีที่แล้ว

    Thanks for the tutorial and it helps A LOT, do you have tutorial on the buttons??

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว +1

      At 12:00 I add buttons in the kick video here: th-cam.com/video/jO7S20XdBfk/w-d-xo.html

    • @abdullahmalukzai1
      @abdullahmalukzai1 2 ปีที่แล้ว

      @@SimTekGameDevelopment Thank you so much.

  • @melihberksonmez7854
    @melihberksonmez7854 ปีที่แล้ว

    Thank you so much!

  • @radicalbros8644
    @radicalbros8644 2 ปีที่แล้ว

    Great tutorial, but how can I change how fast it takes for my player to get up after he takes the hit? Thank you!

  • @manuelrocuant8421
    @manuelrocuant8421 ปีที่แล้ว +1

    Pon los script uno tipea como una hora (somos nuevos), para ver que luego no funciona, asi se nos quitan las ganas de seguir viendo videos que no resultan

  • @isthatabear498
    @isthatabear498 2 ปีที่แล้ว +1

    Is there a way to make this work with explosions, such as from rocket launchers? i'm just making a 2009 styled war ragdoll game.
    thank you.

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว

      Haha yeah, you can add and explosion. I did something similar in a video, I’ll find it

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว

      Just add the explosion where you add the damage th-cam.com/video/tm-ndIZV9y4/w-d-xo.html

    • @isthatabear498
      @isthatabear498 2 ปีที่แล้ว

      @@SimTekGameDevelopment Thanks!

  • @Memered45
    @Memered45 ปีที่แล้ว

    It does not lunch back how do I fix this?

  • @MajesticUC
    @MajesticUC 2 ปีที่แล้ว

    I can see the punch animation but whenever I play with someone else they cant see the animations

    • @ihavebedhead5251
      @ihavebedhead5251 ปีที่แล้ว

      That's a roblox studio thing. If you are playing in team test and the other player hadn't saved the animations yet, then it wouldn't show them for them. It works completely fine in actual game (through roblox itself), though.

  • @DarkThePurple
    @DarkThePurple ปีที่แล้ว

    Is it possible that you can use orientation to body velocity

  • @glegolas5008
    @glegolas5008 2 ปีที่แล้ว +2

    bodyvelocity got deprecated sadly, is it still working?

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว +1

      Yeah it still works. That’s a bummer though. I’ve been playing with the new body movers and they take some getting used to. Fortunately so many games use body velocity it’ll probably work for a while

    • @glegolas5008
      @glegolas5008 2 ปีที่แล้ว +1

      @@SimTekGameDevelopment Yeah that's true, just always afraid of my 5 hour project being ruined by a simple change like this. Hopefully it's for the better though, can't wait to see whatever video you have instore next!

  • @DyingElmo
    @DyingElmo ปีที่แล้ว

    Can you do it as a tool and it will punch the player when you click?

  • @okaynow2217
    @okaynow2217 ปีที่แล้ว

    Is it possible to use these scripts and add it to a projectile like a wand or gun bullets, a part that makes you knockback when hit?

  • @keedahwright6988
    @keedahwright6988 ปีที่แล้ว +1

    Can you link the Script please

  • @KonesMorroh
    @KonesMorroh 2 ปีที่แล้ว

    thanks king. for the knockback.

  • @shiny498
    @shiny498 ปีที่แล้ว

    hey it worked perfectly fine but I just have a question. If I was to make it so that you have more knockback on the next level, how would I implement that? I tried to do loops but that didn't work and I also duplicated the module scripts and made different versions which also didn't work. Do you have any idea of how I'd implement more knockback on a next leaderstat point/level.

    • @theelitist9523
      @theelitist9523 ปีที่แล้ว

      Make a value of Knockback and a localscript to change knockback when level or part touched I think

    • @theelitist9523
      @theelitist9523 ปีที่แล้ว

      Or actually when level changed and level = certain value (datastoreservice)

  • @omargarcia4943
    @omargarcia4943 2 ปีที่แล้ว +3

    didnt work, just spent 1 hour on scripting cus im new too

  • @reqmou4209
    @reqmou4209 ปีที่แล้ว

    can you make a tut for the spawner please!

  • @sw1ft_valorant
    @sw1ft_valorant 2 ปีที่แล้ว

    hey, I was wondering if you can uncopylock this game so I can get a hand of it. It would help and mean a lot to me ;)

  • @jjunee6732
    @jjunee6732 2 ปีที่แล้ว +1

    does this work with r6?

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว

      Yes, but you'd have to make some adjustments, like you'd have to do the animation in R6. I use a R15 animation in the video.

  • @destinedgamerroblox7461
    @destinedgamerroblox7461 ปีที่แล้ว

    Do You know how to change it so it can also be r6???

  • @CrazyyismYT
    @CrazyyismYT 2 ปีที่แล้ว

    Does this work for any script or specifically the ones you are using

    • @CrazyyismYT
      @CrazyyismYT 2 ปีที่แล้ว

      Also, does it work with R6 too? Just asking btw

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว

      You’ll have to make a few modifications, but the core functionality is flexible

    • @CrazyyismYT
      @CrazyyismYT 2 ปีที่แล้ว

      @@SimTekGameDevelopment Thanks!

  • @_nyxshade_
    @_nyxshade_ 2 ปีที่แล้ว

    Is mobile able to punch to or if not how can I make mobile can punch

  • @fauzn._
    @fauzn._ ปีที่แล้ว +1

    How did you make the ragdoll?

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  ปีที่แล้ว

      Bruh! That’s a great idea! The Roblox gun kit has ragdoll code in it. Maybe I’ll do a video on how to lift it up and put it in other code.

  • @KingsIsMeatball
    @KingsIsMeatball ปีที่แล้ว

    I doesn't work for what I wanted to use it for it was for my game about hitting other people with snowballs but when I tried it it didn't work mabye i typed it in wrong but i never said any errors

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  ปีที่แล้ว

      Oh that’s a good idea for the snowballs. I’ll add that to the list.

  • @kumbadak2726
    @kumbadak2726 2 ปีที่แล้ว +1

    can you
    give me all the script please

  • @alexedaxel
    @alexedaxel 2 ปีที่แล้ว

    Punch is pretty good but I would like it to do a r6/r15 ragdoll to the enemy once the enemy is flung into the air by the punch, any way how?

    • @ThatOneGuy-wr8rh
      @ThatOneGuy-wr8rh 2 ปีที่แล้ว

      late, but if you're still on this problem, you can do it pretty simply. just find a way to ragdoll a player and unragdoll them. once that's done, you just ragdoll them when they're knocked back, and unragdoll them whenever it's appropriate (maybe a second after landing, once they get touched by another player, once they touch grass, whatever works)

  • @troyburk4637
    @troyburk4637 2 ปีที่แล้ว

    Great tutorial as always. I was wondering if there was a way to make knockback greater the lower the health of the damage receiver is? Thanks 😊

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว

      Yes you could use the humanoid‘s health, (100-health)*velocityScale, as a multiplier for the power in the knockback velocity

    • @puipuiapachuau6630
      @puipuiapachuau6630 2 ปีที่แล้ว

      l
      ll
      l

  • @klvtm
    @klvtm 2 ปีที่แล้ว

    Hey how to make a maze generator with texture

  • @kilpamations3477
    @kilpamations3477 ปีที่แล้ว

    for some reason it didnt work. maybe because y game is r6? idk

  • @lucabiancardino
    @lucabiancardino 9 หลายเดือนก่อน

    why it does int work

  • @MuhammadIbrahim-bn1mg
    @MuhammadIbrahim-bn1mg ปีที่แล้ว

    it doesnt work. is it because im using r6?

  • @mr_doge1249
    @mr_doge1249 ปีที่แล้ว

    how do i make it owner only?

  • @edgelord83647
    @edgelord83647 6 หลายเดือนก่อน +1

    does it work if u use it on players?

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  6 หลายเดือนก่อน

      Totally!

    • @edgelord83647
      @edgelord83647 6 หลายเดือนก่อน

      @@SimTekGameDevelopment I NEED THIS SO MUCH, I HAVENT TESTED IT YET BUT IF IT WORKS THANK YOU

    • @edgelord83647
      @edgelord83647 6 หลายเดือนก่อน

      @@SimTekGameDevelopment actually, could you find a way to make it into a tool, with the same knockback and ragdoll effect when you hit someone with the tool

  • @spookyh
    @spookyh 2 ปีที่แล้ว

    Mmm, very gooddddd, what about a attack that is like, the enemy floats in air for some seconds then gets fling, sorry me not good at english

  • @guga_en
    @guga_en ปีที่แล้ว

    What about using Remote event

  • @saffinb779
    @saffinb779 ปีที่แล้ว

    You can make a knockback bat r6? Pls

  • @IKanye_south
    @IKanye_south 2 ปีที่แล้ว

    If tried to do this and my punches arnt knocking back any suggestions

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว

      Are you getting any errors in the output window? Is damage being done?

  • @seadrown6252
    @seadrown6252 2 ปีที่แล้ว

    I was under the impression body velocity was deprecated

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว +1

      It still works, it’s in too many games to remove but I’m going to start implementing the newer “forces”

  • @normal_guy_roblox
    @normal_guy_roblox ปีที่แล้ว

    I could only hit one time and the knockback didn't work.

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  ปีที่แล้ว

      Oh check for errors in the output window. If an error occurs after the punch it won’t recover. Check of a typo in your script.

  • @RetrogamingCostello13342
    @RetrogamingCostello13342 2 ปีที่แล้ว

    BV is being depricated, what would you use in place of that?

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว

      Yup! VectorForce will replace it. Thanks for reminding me, I meant to do a video on that for a while.

    • @RetrogamingCostello13342
      @RetrogamingCostello13342 2 ปีที่แล้ว

      @@SimTekGameDevelopment Thanks for the reply, I've been trying to replicate a decent knockback effect with Vectoreforce but it's proving to be a challenge..I can perform the knockback but if I set the speed too low, the target moves a snail's pace, but if i set it too high the target is launched into a new dimension, I'm having trouble finding a way to control the force while also keeping a limited distance..the knockback I'm going for is minor, maybe 2-3 feet from a player's perspective. I can get that knockback but as I said, it's at the speed of a snail and that's not going to make anyone happy lol. Sorry for the rant, I look forward to your next video on this

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว

      @@RetrogamingCostello13342 oh I hear you, the new movers aren’t as easy as the old ones for sure!

    • @RetrogamingCostello13342
      @RetrogamingCostello13342 2 ปีที่แล้ว

      @@SimTekGameDevelopment Yea, all I gotta do is figure out how to set it to a short distance while still having a fairly quick movement. I thought if I set a speed and distance that would work but it really is only changing how far it goes, not how fast it gets there..been workin at it for 3 days, it's driving me insane so I took today and will take tomorrow as well to do some research and see if I can't figure out what I'm doin wrong.

  • @hanfeiliu369
    @hanfeiliu369 ปีที่แล้ว

    Is it suppose to work on a real player

  • @NguyenSon-vq5sz
    @NguyenSon-vq5sz 2 ปีที่แล้ว

    How to do it ragdol

  • @user-tm8pi2mi1m
    @user-tm8pi2mi1m 6 หลายเดือนก่อน +1

    its g - u - i not gui bro

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  6 หลายเดือนก่อน

      Gooowiii, it’s fun to say man! Join the dark side 😈

  • @kelvincoemsfactory
    @kelvincoemsfactory ปีที่แล้ว

    why doesnt the knockback work

  • @airbuz7450
    @airbuz7450 ปีที่แล้ว

    HI, mate I have checked for like 2-3hrs and I still don't understand, when I deal dmg to a player, they take dmg but have no KB, but when I deal dmg to a zombie in your vid, it takes not dmg but have KB and the KB seems to come from their attack which mean they r knocking them self off me when they attacking (I didn't even press the F key),I would love to get some help from you if it's possible ,so I can show you my script and how the npcs behavi and see if we can fix it or not, if you r willing to help me please leave your contact in my comment, I look forward to recive your news, thanks!

  • @basicallyloser2023
    @basicallyloser2023 2 ปีที่แล้ว

    bro i typed everything checked it 5 times and everything is exact followed every minor movement, shit dont work

    • @SimTekGameDevelopment
      @SimTekGameDevelopment  2 ปีที่แล้ว

      Did you check the output window for errors? Does the animation work? Or is it the knock back. It definitely works, might be something small, but there’s something you’re doing different.

  • @Psxtradescam613
    @Psxtradescam613 2 ปีที่แล้ว

    add kill

  • @user-ho4vr4uq5f
    @user-ho4vr4uq5f ปีที่แล้ว

    its pronounced (gee you iii)

  • @blobviskip
    @blobviskip ปีที่แล้ว

    sombody have free script?

  • @xxCarlosPlaysxx
    @xxCarlosPlaysxx ปีที่แล้ว

    Does ir work with real players?