Introduction:
Hi! Im Fenix7667 and I made a cool thing that I think will help you guys!
This module allows you make easy and fast knockbacks calculating the mass of the player. But its not only that! The module allows you apply knockbacks in objects, and the descendants of the object plus the object! And with this you dont need make the same thing again and again.
How to use it?
To use the module are very simple. Just create a script/local script, require the module and use it! Example:
--\\Player's Knockback Example://--
KnockbackModule:Knockback(ChoosedPlayer,10,true,0.01,Enum.Axis.Z,false,SecondPlayerBased)
--[[
The "ChoosedPlayer" are the player that will receive Knockback.
The number "10" are the power of knockback. If you choose the number 10
it will be 10* stronger.
The "true" condition are for "StopKB". If you want to Knockback be
endless make it as false. But if you want to it dont be endless
put it as "true".
The number "0.01" are for the amount of time the knockback will stay.
PS: It only work if the "StopKB" are enabled.
The "Enum.Axis.Z" are the direction you want to knockback go. (X,Y,Z)
The last argument "false" is for "DirectionOpposite" if you put it as true the knockback direction will be the opposite that you selected.
--]]
----\\Object Knockback Example://----
KnockbackModule:ObjectKnockback(ChoosedObject,10,true,0.01,Enum.Axis.Z,false)
--[[
Its the same of the other example above, but dont have "Second Player Based" and instead of a player Its a Object.
--]]
----\\Object And Descendants Knockback Example://----
KnockbackModule:ObjectAndDescendantsKnockback(ChoosedObject,10,true,0.01,Enum.Axis.Z,false)
--[[
Its the same of the other examples, but this method dont have "Second Player Based" and apply knockback for the ChoosedObject and all base part descendants.
--\\More information in the module!//--
--]]
How it works?
This module gets the mass of each object / player character using descendants. The module also creates a folder with all mass values. After he makes the MaxMassValue which are used for the velocity. When the velocity gets set the folder get destroyed.
Images:
Here I show the three types of knockback:
https://i.gyazo.com/b3dc854b86fee8e6b8f78bac91083be4.mp4
https://i.gyazo.com/02920d3901fb7245e364dc78092c68d0.mp4
https://i.gyazo.com/a88eb42bdf5b3521db31ce0e892daed5.mp4
Conclusion:
Its my first Module and I hope it helps everyone to make more easier knockbacks.
I made this because I needed a module like this, and dont make the same thing again and again and again. Thanks for reading till here!