How to script a weapon in Roblox with multiple slash animations

Поділитися
Вставка
  • Опубліковано 21 вер 2024
  • Video Description:
    Starting with a basic sword mesh, I guide you through creating captivating animations and combining them with powerful scripts to craft a fully functional great sword tool. Not only will you learn to script a multi-slash repeating combo, but this versatile method may be applied to various non-tool-based systems as well with just a few modifications. Join us and embark on a journey to master scripting a basic sword.
    Fancy description stuff aside, this video took me ~6 hours over the course of several weeks to edit. The original recording was about 70 minutes, so the final 20-minute video may be fast-paced and require pausing, but should be much easier to follow along than many of my previous tutorials.
    Questions / Help:
    For assistance with any problems you may have following the video or in general, please post in the appropriate channel in the Knine's Scripting Lessons Discord server ( / discord . Please follow the post guidelines for the appropriate category (usually scripting) or your post may be ignored.
    If you can't use Discord or don't wish to, feel free to post questions here in the comments section but know that I may be slow to answer or may miss your comment entirely. Additionally, follow these guidelines in your questions:
    1) What is the specific issue you're having and what are you trying to do?
    2) What have you tried to do to fix it so far?
    3) Send relevant code chunks (if it's scripting) with the formatting below and any relevant errors/warnings if there are any.
    Hotkeys I use:
    Ctrl + L: Switch between local and global movement/rotation when building or animating (Ctrl + Y in Moon Animator I believe)
    Ctrl + D: Duplicate an object in place (or on top of if collisions is turned on)
    Ctrl + C, Ctrl + V: You should know what these do
    Ctrl + X: Cut, which is both a delete and a copy
    Alt + Click: Select an object through a group
    Ctrl + Click: Add an object to the selection without removing previous selections
    Ctrl + Alt + Click: Add an object to the selection through a group

КОМЕНТАРІ • 39

  • @cryptic2742
    @cryptic2742 Рік тому +10

    This was honestly extremely helpful, thank you

  • @enxolamb
    @enxolamb Місяць тому

    yo bro, your the goat btw. I have a question i cant seem to find any video on this. How can i script an NPC that gives you this custom weapon, and transfer the weapon and its animations to the player? (without it being implemented in every starter player. i want the sword to be given Only for those who talk to the NPC.) Super helpul video !

  • @RoflcopterLamo
    @RoflcopterLamo Рік тому +4

    I stan LUA

  • @jgxylsgkMgzkghllyxlgkgxxlhm
    @jgxylsgkMgzkghllyxlgkgxxlhm Рік тому +15

    Now make elden ring

  • @DemonPal
    @DemonPal 10 місяців тому +4

    bro what 😭 i dont get anything bro where do i even start, can you make a baby version where you explain everything such as what wait for child does, invoke server the differences etc 😭 bro ill even watch a 8 hour video to understand the same thing

    • @Knineteen19
      @Knineteen19  10 місяців тому +4

      Haha if you're new to scripting I would recommend the following series:
      ua-cam.com/video/BfLUt3mfJiY/v-deo.html
      ua-cam.com/video/BkYwRdCukZA/v-deo.html
      Or you can check out some of the tutorials on the documentation like this one:
      create.roblox.com/docs/tutorials/scripting/basic-scripting/intro-to-scripting
      Also feel free to join the Discord server and you can ask questions about anything you want as you go along your developing journey, or not, if you don't want to.
      Though I suppose I'll answer your questions really quick too:
      :WaitForChild() repeatedly waits for a child (meaning something inside something else) of the provided name (inside the parenthesis), and will wait indefinitely until some child of that name is found (giving an infinite yield warning if it takes a while, but continuing to wait nonetheless)
      This can be compared to simply doing something like char.Humanoid, in which you don't wait for the humanoid whatsoever, and the code will simply give an error if the humanoid isn't found or isn't loaded in in that exact moment.
      Alternatively, there's also :FindFirstChild(), which takes a string/the name just like :WaitForChild() does, but it also happens in that exact moment, not waiting for the child, but rather returning "nil" rather than giving an error, if the child isn't found. :FindFirstChild() is mostly useful in cases where you don't know whether or not a child is going to exist, and you just want to check if it does or not at any given moment.
      :InvokeServer() is a function of RemoteFunctions, which you can learn more about that and RemoteEvents here:
      create.roblox.com/docs/scripting/events/remote
      But basically the idea is that there's a client side (the player's PC) and a server side (some Roblox-owned server computer somewhere else in the world), and RemoteEvents and RemoteFunctions both allow you to communicate information between client/server. RemoteEvents simply send a signal to do something (either client -> server or vice versa), whereas RemoteFunctions are more like functions in that the "invoker" will actually wait for the "invokee" to complete it's stuff and can even get a return value before the "invoker" moves on to the next line. For example, if a client script invokes the server through a RemoteFunction, it will wait for the server to finish doing its stuff before moving on to the next line of code.
      You can also probably find a variety of UA-cam videos explaining RemoteFunctions and RemoteEvents as well, but that's the general gist.

  • @mkidp4481
    @mkidp4481 8 місяців тому +4

    followed all the steps until 4:31, and it won't print

    • @incription
      @incription 7 місяців тому +3

      Disable requirehandle in the tool

  • @AntixRL
    @AntixRL 4 місяці тому +2

    im having a problem where the tool stays in my root part even when the animation is active. please help

  • @Harv770
    @Harv770 Місяць тому

    It didn't work for a bit and I didn't know why but then I found that the tool.RequiresHandle was set to true :(

    • @Harv770
      @Harv770 Місяць тому

      W vid tho thanks so much!

  • @YakoBlast
    @YakoBlast 8 місяців тому

    Cool

  • @syathepainful3083
    @syathepainful3083 6 місяців тому

    Whats on line 2 for the local script?

  • @tuiphonepaseuth7881
    @tuiphonepaseuth7881 5 місяців тому

    Tool.Equipped wont work without any handle inside how do i fix it?

  • @Simply842
    @Simply842 10 місяців тому +1

    how do i prevent dying from breaking the whole thing

    • @Knineteen19
      @Knineteen19  10 місяців тому

      Uh do you think you could be more specific? Like dying when you're holding the weapon, dying when you're not holding the weapon, etc., as well as what you mean by "breaking the whole thing". Does it not deal damage, does it not let you equip the sword, or what specifically stops working?

    • @Simply842
      @Simply842 10 місяців тому

      @@Knineteen19 if you die well holding the weapon then equipping it nolonger clones the weapon model or enables the anims

    • @Simply842
      @Simply842 10 місяців тому

      update if you die AT ALL regardless of having the weapon equipped then it stops playing anims for the weapon and stops cloning the weapon model@@Knineteen19

    • @Knineteen19
      @Knineteen19  10 місяців тому

      If you're getting the "Cannot load the AnimationClipProvider Service" error like I am, then I'm honestly not sure what the issue is. I did some research (devforum.roblox.com/t/cannot-load-the-animationclipprovider-service/1956681 ) but everything I can find is just saying to add a small delay before running :LoadAnimation(). Even when I add a 5 second delay though, it doesn't change it and the error just comes 5 seconds later instead.@@Simply842
      If you're getting a different error than the one I'm getting, then just let me know too.

    • @suicidacraft6317
      @suicidacraft6317 3 місяці тому

      try changing
      local character = player.Character or player.CharacterAdded:Wait()
      to
      local character = player.CharacterAdded:Wait()

  • @playsuteshon618
    @playsuteshon618 10 місяців тому +1

    Output say nothing when I am at 4:30

    • @mkidp4481
      @mkidp4481 8 місяців тому

      sameee its driving me insane

  • @VipoYT
    @VipoYT 6 місяців тому +2

    now make Q to PARRY >:DDDDDD

  • @RAHHHHHHHHHHHHHHHHHHHHHHHHH11
    @RAHHHHHHHHHHHHHHHHHHHHHHHHH11 11 місяців тому

    Inside the animate thing i dont hsve torso and all that

    • @Knineteen19
      @Knineteen19  11 місяців тому +1

      I'm not entirely sure what part you're talking about, but it could be that the animate script was changed in recent Roblox updates or something. Can you send a timestamp for the part you're talking about?

    • @RAHHHHHHHHHHHHHHHHHHHHHHHHH11
      @RAHHHHHHHHHHHHHHHHHHHHHHHHH11 11 місяців тому

      ​@@Knineteen1910:20

    • @Knineteen19
      @Knineteen19  11 місяців тому

      Ah okay. I mean if you're using R15 then your script would be different since "Torso" is only for R6. It doesn't really matter though, since all you really need to change is the variable that references the player's character, since the animate script won't necessarily be inside the character model itself like it would be normally.@@RAHHHHHHHHHHHHHHHHHHHHHHHHH11

  • @MolesterID
    @MolesterID 6 місяців тому +1

    Is this out dated?

  • @StephenNwoga-q6e
    @StephenNwoga-q6e 5 місяців тому

    i tried to make a dual blade version and failed
    could you send a tutorial on that

  • @Simply842
    @Simply842 10 місяців тому

    for some reason using events instead of functions doesnt work

    • @Knineteen19
      @Knineteen19  10 місяців тому

      If you're referring to RemoteEvents versus RemoteFunctions, note that there is a difference in the syntax of each. You can look here to see how each one works: create.roblox.com/docs/scripting/events/remote
      Unless you're talking about something else when you refer to remotes and functions.

    • @Simply842
      @Simply842 10 місяців тому

      yes i did screw it up, is there a way that i can make only the final hit do knockback? i have tried it myself but activateE seems to be double fired so if i use the same system as the local script in the server script then the attack count is always increased by a random number instead of the amount its supposed to (1)@@Knineteen19

  • @anselhendrixharidjan3003
    @anselhendrixharidjan3003 7 місяців тому

    Can u give me the script

  • @oddjr
    @oddjr 11 місяців тому

    tried following this but only made it half way.. could not get the idle animation to load in. Bummer.
    OnServerInvoke is not a valid member of RemoteEvent "ReplicatedStorage.Events.Weapons.ColdSteel.Equipped"

    • @Knineteen19
      @Knineteen19  11 місяців тому

      Ah it's because RemoteEvents and RemoteFunctions have different syntaxes for how they're used. This documentation page is a great quick resource for the syntax of both and also gives a good explanation of how they both work: create.roblox.com/docs/scripting/events/remote