![]() ![]() Then in a server script inside the tool, you fire a RemoteEvent (which is also inside the tool) so that way the local script can ‘play’ the animation. Local loadedAnimation = humanoid:LoadAnimation(animation) ![]() Local animation = Instance.new('Animation') Here’s just an example, but this is what I have inside my Animations module script (which is located inside RepStorage) local animations = įunction animations:Load(animationID, humanoid) Nested if statements is bad practice and will impede the readability, organisation and scalability of your code. Consolidate your code and make it reusable.Don’t use an external script to damage, use a method of the Humanoid to decrement health (Humanoid:TakeDamage or Humanoid.Health = Humanoid.Health - Decrement).Push some work off to the client, such as the playing of animations. Instead of loading ones you will and won’t need, load only the one intended to play during this sequence. Your animation variables should be converted into a table.In terms of the code you posted above though, I’ve got a few things of my own: What is it explicitly that you are trying to achieve: the creation of a combat system or the improvement of your code above? ![]() The title and contents of your post are slightly contradictory. Please use that from now-on when you are posting code to the forums. Proper codeblocks are created with three backticks. Tips on how I can make a better/more efficient system are appreciated! here I would then randomize the animation and load Animations into the character Local Anim3 = Humanoid:LoadAnimation(script.Anim3) Local Anim2 = Humanoid:LoadAnimation(script.Anim2) Local Anim1 = Humanoid:LoadAnimation(script.Anim1) Local combatRemote = ĬombatRemote.OnServerEvent:Connect(function(Player) here’s a short summary of how my system works: -local script ![]() I’m an aspiring solo developer and my goal is to become a jack of all trades on this amazing platform.Between late 2017 till now, I’ve been learning how to code but I’ve realized that my code usually lacks efficiency and that there is always a better way to things.I finally decided to work on my own game but I’m having a hard time deciding on what’s the most efficient way to code my combat system. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |