Raycast Hitbox 4.01: For all your melee needs!

Current Version: V.4.01 Stable (09/21/2021)

Notice

I will be releasing a new module with new features, including Shapecasting in the near future. Stay tuned! More information:

Raycast Hitbox 4.01: For all your melee needs! - #1133 by TeamSwordphin

Upgrading from 3.xx to 4.0

Please note that V4 is not backwards compatible with V3. There are a few API changes that were introduced in V4 to better suit modern code etiquette. Here are the changes you need to know if you want to make your code compliant with V4:

Raycast Hitbox 4.01: For all your melee needs! - #597 by TeamSwordphin

Notable Features

  • Accurate, performant, and easy to use!
  • Use attachments or vectors to make your hitboxes in seconds!
  • Attachment pairing to create straight-line hit detection!
  • Support for automated individual part hit tracking, humanoid only, or even unfiltered hits!
  • Hitbox distinction (for example, smash bros tippers!)
  • Hitbox Time Scheduler, set and forget; let the module turn off the hitbox for you!
  • Supports Mesh Deformation!
  • No credits necessary and full help support available!

Introduction

Hi there! I just released a module that focuses on raycast hitboxing, so things like melee weapons will probably be the most useful. But feel free to let me know what other projects you will use this for!

OR

Example Place

Direct download
RaycastHitboxShowcaseV4.rbxl (107.4 KB)
(do note that these places won’t be updated, so if this module gets an update, you have to do it)


Original Post & Examples

A few years back, I’ve been intrigued by the design of MORDHAU and Chivalry since I wanted accurate hitboxing while making it simple to do across a variety of different weapon shapes and sizes. Here’s a timestamp of how MORDHAU did their hitbox for their swords which may prove to be helpful.

Warning: Does include realistic depiction of blood so please be aware before opening

It basically fires a ray from an attachment placed on the weapon every frame. Do note that the red lines are visualizations purposes only, they do not last that long.

https://gfycat.com/welcomeglitteringkillifish
https://gfycat.com/fairsecondaryafricangoldencat

I also made it so you can adjust the placements of where the raycasting starts via attachments so I can fit it on different weapon shapes easily without hardcoding it. Here is the same system but the attachments are spread out a little to compensate for larger hitboxes.

https://gfycat.com/enchantingdecentbeagle


How To Use

Thankfully, it is very simple. Head over to my Github wiki which has extensive documentation and examples that will get you up and running in less than a few minutes!


Why Raycasting over Touched, Region3, etc… ?

I had a little thought process on the end of this thread, so you can check it out if you’re curious on why I opted to go for raycast.


Limitations

  • HitStart only hits a target once (so multiple rays don’t hit the same target). Call HitStop to reset this target pool so you can hit the same targets again. The module supports different detection modes, so if you dislike this functionality, there is a way to change it.
  • Wide objects requires a lot of attachments to be working correctly

Update Log

Current Version V.4.01 Stable (09/21/2021)

–

Previous Versions & Downloads
V.4.0 Stable (07/02/2021)
  • Rewrote module to more legible and with more common coding etiquette
  • Typechecking
  • Minor hit detection optimizations
  • Significantly more optimized debug visualizer rays
  • Different Detection Modes
  • Mesh Deformation support
  • Debug Visualizer rays no longer give false positives to the hit detection
  • Debug Visualizer rays switched to LineHandleAdornments
  • Module is now Rojo-compliant at Github
  • More Information: Raycast Hitbox 4.01: For all your melee needs! - #597 by TeamSwordphin
V.3.3 Stable (02/25/2021)
V.3.2 Stable (11/18/2020)
  • HitStop switched to table.clear, for much better table reuse performance
V.3.1 Stable (11/14/2020)
  • New OnUpdate Event
  • Switched AncestryChanged to CollectionService to fix memory leaks
  • Removed RenderStepped sync rate
  • Fixed some inconsistent signal error messages
V.3.0 Stable (10/15/2020)
  • New Hit Distinction group feature
  • Significantly improved hit detection performance
  • No longer need to disconnect OnHit events!
  • Everything should now be ipairs
V.2.3 Stable (10/13/2020)
  • Removed redundant function calls in MainHandler
  • Significantly improved HitStart/HitStop performance
  • Removed CollectionService ‘RaycastEnabled’ tag (if you were relying on this, it is no longer supported)
  • Fixed inaccuracy issues when a hitbox was deleted
    RaycastHitboxV2.rbxm (9.0 KB)
V.2.2 Stable (8/22/2020)
  • Added WarningMessage bool
  • Minor performance improvements
  • Folder/readability reorganization
  • Documentation improvements
  • GetHitbox returned
V.2.1 EXPERIMENTAL (6/05/2020)
  • Now uses new Raycast API!
  • Removed Hitbox.ignoreList
  • Added Hitbox.raycastParams
  • OnHit now returns 3 arguments: hit, humanoid, raycastResults
V.2.0 EXPERIMENTAL (5/30/2020)
  • Removed RaycastHitbox:DebugMode
  • Removed HitStart([damage value]) argument
  • Removed DontCheckForTransparency
  • New HitboxObject:DebugMode
  • Major Performance Improvements
    RaycastHitboxV2.rbxm (8.4 KB)
V.1.53 BETA (4/03/2020)
  • Updated some outdated API
  • Clarified some troubleshooting steps
  • Added a new troubleshooting question
  • Added warnings whenever it detects rays are not being shown
    RaycastHitbox153.lua (17.9 KB)
V.1.52 BETA (3/25/2020)
  • Fixed LinkAttachment position errors
V.1.51 BETA (3/24/2020)
  • Fixed SetPoints position errors (should now be as accurate as attachments)
  • Credits to @Shurikanz for the find
V.1.5 BETA (3/23/2020)
  • New HitboxObject:RemovePoints
  • New HitboxObject:LinkAttachments
  • New HitboxObject:UnlinkAttachments
V.1.3 & V.1.4 BETA (1/28/2020)
  • Initialize should now return a hitbox and not nil
  • Mild performance increases
  • New Function: PartsMode (documentation is in the script)
1.21 BETA (10/30/2019)
  • Removed RaycastHitbox:HitStart
  • Removed RaycastHitbox:HitStop
  • DebugRays remade with constraints/attachments to help low-end devices
  • Initialization performance improved
1.2 BETA (10/27/2019)
  • New HitboxObject:SetPoints(Instance part, table vectorPoints)
  • New RaycastHitbox:DebugMode(boolean true/false)
  • Recursive now supports all instance types (no longer have to be a model!)
  • Ignore list now automatically includes Terrain
1.1 BETA (10/24/2019)
  • Deprecated RaycastHitbox:HitStart
  • Deprecated RaycastHitbox:HitStop
  • RaycastHitbox now returns HitboxObject
  • New HitboxObject:HitStart
  • New HitboxObject:HitStop
  • New HitboxObject.OnHit:Connect(Instance part, Instance humanoid)
  • New RaycastHitbox:GetHitbox(Instance model)
  • Possible Issue - Heartbeat loop might not successfully disconnect when deinitializing, but happens sometimes (need confirmation)
1.0 BETA
  • Initial Release

Like this module? Please consider donating a little to support my future works!

You can additionally file additional pull requests or bugs at my github repository (though if you DO have bugs, replying to this thread is much faster)


My other modules:
Inverse Kinematics and Procedural Animation
Part Pooling

1432 Likes
Experimental Inverse Kinematic and Procedural Animations
Laggy players can't register weapon hits, best way to get around without "trusting the client"
How to make a perfect hitbox?
How do I make a clean hitbox?
Custom Enemies and Hit Detection
Alternative to welding hit-boxes?
A better way of hit detection when .Touched isn't available?
Simple Punch Script
Ways to implement melee hit detection?
Best method for hitbox detection?
How to make a good melee? with a good hitbox
Touched Randomly works
RayCasting: Can You Ignore Something Based On A Part's Name?
What is the most efficient way to create a fighting system?
Combat Warriors Information
Most Efficient and Performance wise method for Cube-like Hitboxes?
Melee Raycast problems?
Client cast vs Raycast hitbox. Which is better?
Problems with script logic with tools
kvKAVI | Portfolio
What is the best way to cast large projectiles?
Melee Hitboxes - What Is The Best Solution, and is the Touched event really that bad?
Unique game concept - Looking for a scripter
How to prevent certain output?
Correctly Performing Spatial Queries
Combat doesn't detect hit sometimes?
Making a making a hitbox more accurate?
Creating attachments along part
What is the best option for hitbox?
I need some tips on a combat system
Detecting If A Tool Is Interacting With An Object
MeleeHitboxModule not following model until after a hit
Is it even possible to have an accurate weapon hitbox that grabs all touching parts (including noncollide)?
Ignoring accessory handles
ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries
How would i go about making hitboxes like in mortem metallum
Having trouble figuring out how to get my touch event to work
Melee hitbox handling
How do you make a your Combat system in your games
My thoughts about client side vs server hit detection
Trouble with region3s and latency
Projectile damages caster
What is your best way to create a hitbox?
Zone+ v1 (deprecated) | Retrieving players within an area/zone
Raycasting Hitbox Module cancelling on accessory
How can I raycast a part
Ban Hammer for King Of The Hill game
How to do raycasting!
Populus Romanus Credits
How would I go about kicking a ball?
How do i extend a sword hitbox?
Raycast hitbox animation issue (Rays are inaccurate)
Why does my sword only work when I put it in starterpack
Combat Testing Information
Client cast vs Raycast hitbox. Which is better?
Best way to have player damage each other by touch
Melee client lag compensation
What kind of hitbox should I use for different sized characters? (Punch Combat)
Where to handle hit detection?
Melee Take Damage Issue
Touched not connecting
Gun projectile with raycast hitbox
What is the best practice for projectiles
How can I improve this combat system?
Is there anyway to do a Raycast with a bigger width?
What should I use to make a punching combat system?
Game Latency Issue
How Would I make a Raycast hitbox
What Are Raycasting HitBoxs?
Help with Raycast
Grab Player tool
How do so many PVP games run combat so smoothly?
Raycasting question and swords
Which method would be most reliable for Touched?
Question about hitbox combat system
ClientCast - A Client-based, Idiosyncratic Hitbox System!
.Touched wont work for tweening object
Blackout Credits
Upgraded, Improved, and Faster Raycasts
Need help with accurate collision detection
Weird problem with raycast hitbox i'm making
Melee Raycast Hitbox
How to get better collisions / react
Feudal Japan | Credits
[OPEN SOURCE] Lock-On Combat in 3D
When should I be using custom signals?
How do I create a part on the size and position and angle of a raycast weather it hit something or it did not
Should I handle weapons on server or client?
About hitbox problems
Help with Raycast Hitbox
Tool that breaks items in front of player
Accurate, moving hitboxes?
Touch Event not working
Issue with HitBox Module!
Bullet hit detection
:GetTouchingParts is not working as intended
How Would I Make A Good Raycast Hitbox For Barrage Ability?
How do I make hitboxes?
(Help) :Touched() Function not triggering
.Touched not firing in time
A Brand New Hitbox Module!
[Discontinued] Unusual guns: Information
How can I use RayCastHitboxV4 for a combat system?
Better hitbox system
Make Car do damage when touched
What hitbox system is the best?
Raycasting between two attachments
Best way to make a simple yet effective melee system?
Trouble with melee raycast hit detection
How to make raycasting hitboxes
Combat hitboxes
My moves are extremely buggy and extremely laggy, please help!
Trouble figuring out melee system
ZonePlus v3.2.0 | Construct dynamic zones and effectively determine players and parts within their boundaries
What would be the best way to make hitboxes for a fighting game?
Best coded alternative for replacing .Touched events?
Melee Combat Hit Registration
What's the best Collision Type for an ability hitbox?
How To Make A Proper Hitbox
ÂżHow can i fire multiple RayCasts?
What hitbox would be the best in my case
Hitbox Detects Punching
How to find touching point
Feedback about Test Game
How to make multiple raycasts easily
ClientCast - A Client-based, Idiosyncratic Hitbox System!
Radiation System with Raycasting?
Katana damaging players not working!
Humanoid Isn't taking damage
Hitbox Library V1
Trying to make blood thing spawn where you hit in the animation
Trying to make blood thing spawn where you hit in the animation
Alternative to .Touched for fast and responsive stickiness
Blocking Issues
Hitbox being destroyed at the wrong time
STREET FIGHTER | Update Log
Damaging a player once with a tool
Trouble with loading an hitbox on client
Filling gaps inbetween spatial melee attack hitboxes
Raycast Parms / Blacklist
Best method for a melee combat system?
How would I incorporate Raycast V4 into a fists tool?
Whats a good alternative for Touched events?
How can I improve this raycast combat system?
Inconsistent Raycast registering hit
Trouble with making a sword damage things
Help with raycast
How to raycast with attachments on melee weapons?
Release Notes for 568
Hitbox for any weapon
How can i affect multiple enemies with a single attack?
I want make two hand weapon
Movement in game affecting hit detection
How to make a good use of Raycast Hitbox V4.01?
Best way to make hitbox for Fist Combat
Sanguine Fields [BETA] - Credits
Tool still damages the player holding it even when using if to check if it's not the holder getting touched by it
Question about combat system in the client
Hitbox only detects hits randomly
How to make a skin system like zo?
What is best for a hitbox?
[OPEN SOURCE] Updated Lock-On Combat in 3D
Trouble with melee hitting multiple targets
Raycast Module Offset Problem
Feedback On Raycast Sword
Problems with the combat system
Need help with combat system (solved)
Help Detecting Touch from a part
Best Hitboxes for this?
What are the best ways to detect a hitbox?
What is the best alternative for .Touched but not ZonePlus or Raycast hitbox?
Returned key with metatable becomes nil, why?
Help With Certain Sword Attacks/Features
How to create and use HITBOX
How can I make my attack damage everyone that touches it and not only one dummy?
Is there a more consistent way to do collisions?
Upcoming Optimization to Collision Detection System - Beta Test on Mac Clients soon
How can I make my combat script better
How to make client side hitbox for combat game
GoryTown 2 - Main Post
Should I use remote event for swords?
Touched function is unreliable for hitbox
Raycasts vs. Spatial Queries
RaycastHitboxV4 detecting hits from far, where it doesn't hit visually
RaycastHitboxV4 detecting hits from far, where it doesn't hit visually
My weapons use client-sided hit detection. How should I go about securing them on the server?
Many issues with a fighting game im making
Effective way to make a weapon?
Hitbox for Fast Moving Objects
Step by Step to make an advanced and complex combat system
Help on figuring out an effective way to do an enemy NPC's attacks
Client Or Server for melee detection?
How to make melee hitbox
Securing Client-Side Hit Detection in Sword Combat
2023 Year in Review: Extreme Wall Running, Rhythmic Ocean Waves, Demonic Heads, and More!
Need help with projectile hitboxes
Weapon Swing / Hitbox Script
Help with Hitboxes
Add damage to my punching tool
Ways to deal damage? What's the best?
How should I go about making a hitbox?
How does hitboxes that uses attachment work?
Lag with BasePart.Touched
Help with hitbox system!
Portafolio: Roblox Scripter | Luau Scripter
How to make perfect hitbox
Raycast hitboxes and exploits
Making A HitBox
Why is tool not working after clone?
Script doesnt detect if being touched by part but does detect if touched by rig?
High speed tween object not detecting hits sometimes, along with choppy animation
How to make a shell drop system?
# | best posts - free/paid | #
How can I further improve this combat system?
PB (Prison Brawl) Information:
How do games like Mordhau, Chivalry 2 and Criminality achieve their procedural weapon animation swings
Should weapon trails be handled on the server or client?
Hitbox in Client or Server
Help with hitbox system!
Attempt to call missing method 'Start' of table
Tsunami Game Credits
Making a combat game with ranged weapons? FastCast may be the module for you!
Boston Remastered: Credit List
Player dying and getting damaged by tool
Creating an unkown sword slash effect
Sword only damages one NPC and not other NPC's
Is there such a thing as good square shaped hitbox detection for combat?
Could a TextLabel (or buttons) detect if there is a Humanoid on It?
Best method for hitbox detection?
How do u throw a sword w/ FastCast module?
Part Pooling - Increase performance with many parts
Best way to go about punching system collision detection?
Fast Paced Combat
Increasing Ray Thickness & Making Ray Hit Multiple Targets
How to debounce Touch events client side?
How would I use magnitude to check if a player is near a tree for an axe script
Touched Event Alternatives?
Why do some stuff stop working in my game?
Better way to detect hits for a combat system
How to make my skill detect players and do damage?
Attacks Effecting Multiple Targets
Best way to go about punching system collision detection?
Weapons only doing damage after reaching a keyframe
Scripting Resources Mega List
What's the best way to do a hitbox to check in front of the player?
How to use Raycast Hitbox Module Serversided?
VVG's "Survive a Plane Crash" Credits
Touched event sometime not registering, when used on ServerSide
How do i secure my remote event?
.Touched or RayCasting for meele weapons?
Making a combat game with ranged weapons? FastCast may be the module for you!
Best method for hit boxs?
Multiple ray casts to find a target (client sided) good or bad idea?
Is magnitude too costly for a sword?
Best method for detecting characters touching each other?
:GetPartBoundsInBox hitbox delay
Feedback on sword script I made
What is a good method for hit detection on my sword?
Melee Hitboxes - What Is The Best Solution, and is the Touched event really that bad?
What is the best way to make a melee tool damage?
What is a good method for hit detection on my sword?
BodyVelocity is not working for high ping players
Need help with raycast hitbox
How would I go by this fast-paced combat?
How to find every vector3 point inside of a part?
Tired of using Touched for weapon hitboxes? Use HitboxCaster
Tired of using Touched for weapon hitboxes? Use HitboxCaster
How create wounds on players damaged by swords?
Hitbox creation function
How do I go about making a parry with a sword
How to do hit detection for a fast and large projectile
Help with simple hitbox system
Is it a bad idea to handle hitboxes with GetTouchingParts?
Punch Script Punches without button being pressed
Can i weld a Region to a player?
Server Lag Problems
Creating a script for melee fighting
I made a damaging part for a simple sword I made and it doesn't seem to work
Best Simple Hitbox for basic combats?
Hitbox reviewal
Magnitude Vs Hotboxing or RayCasting
Breaking a player's attack mid way through

Awesome module! Very useful and very accurate! I suggest adding a way so you can control what happens when you hit something. For example if I wanted to be able to also hit certain parts with my weapon to destroy them I could. Have it so it will return “hit” like the touched function does. Just a suggestion! Would make this module 10/10 just by having that feature! Good work! Keep it up!

73 Likes

Awesome, Thank you for considering the request!

I’ll provide further feedback when I get to it.


@TeamSwordphin

BeforeWithComments.lua ¡ GitHub

I asked a friend to make a more optimized version of the script.


I also notice that you are using a lot of Rays, can it be reduced to using only a few maybe 5?

One in the top left, top right, bottom left, bottom right, and middle along with the Hitbox

Instead of creating many horizontal Rays can you create less with Vertical Rays and still have the same or better performance?

Perhaps the Attachement could automatically be created and all you need to do is create a HitBox part, then use CFrame to get the size and sides of the part then create Damage points depending on how big it is.

33 Likes

Okay now I have to use it given that it’s an open source resource now. I absolutely have to.

From the moment I first saw those hitboxes in action, that became one of my new favourite development-related threads. Being able to work with the logic behind it is a blessing and I thank you very much for sharing this resource with the community.

Melee hitboxes are definitely a rising topic on the DevForum as developers are creating more melee-centric games and a common question throughout the forums is how to achieve accurate hitboxes while accounting for several factors, up to determining which method is most performant and suitable.

Setting the thread to watching to keep up with any discussion. Thank you so much for this.

53 Likes

Thank you! I planned on something like that but ran out of time to make yesterday :sleepy: If I have time today I will absolutely update it with that functionality.

18 Likes

Very nice, This is the best hitbox script i’ve seen so far!

20 Likes

This feature looks AMAZING! Completely ignoring the practical uses for is the ‘SwordShieldMan’ looks cool twirling around a sword covered with red laser beams (aka. hitbox thingies).

In terms of practical uses, I believe this is going to be amazing to use, especially since detecting the.Touched event on a low end device is… Ya know…

Unfortunately as much as I love the rays following the weapon I feel my players may not feel the same way so I guess I wont have that enabled in my projects :frowning:

In conclusion just thank you, this is such a well made solution to one of the most irritating problems on roblox and I didn’t even have to go through a pack of harribos keeping my mind focused enough to script it!

Just to confirm, the thing about using the beams was a joke @ScriptingSupport

18 Likes

AFAIK the rays are only intended for debugging purposes and you aren’t meant to actually enable them within a production environment.

20 Likes

Ah thank you! Before I could reply to your DM, I see you already edited it so I’ll just reply here instead. Let’s start from the top.

  1. There are some slight changes in the optimized version that I think are unnecessary, but overall I think it is ultimately an improvement. DebugRay code was copied directly from the raycasting wiki so take it up with the writers :upside_down_face:. Still at work, so I’ll look at the optimizations a bit more thoroughly later.

  2. I assume you are talking about the SwordNShield NPC above. I’m not sure what you mean by vertical rays, but I suppose if I am visualizing it correctly, something like a ray starting from a sword handguard to the end of it’s blade tip. There is a possibility that you can increase performance with vertical rays like this, but speedy swiping motions will not have a guarantee that it will hit if the target are between the vertical rays between the last and current frame. This will be no different than using a touched event imo (faster physics = less likely to hit).

  3. Automatic attachment generation sounds neat, and I can probably try something like that. Though this may become intricate and difficult if it has meshes or weird shapes, and may even reduce performance depending on its complexity.

Overall, for simple swords, I would just string the attachments along the blade, and maximum 15 of them. Though the SwordNShield NPC has no problem having over 180+ rays being made at once.

20 Likes

I went to art school, this is what they call a master piece

This shouldn’t be a problem if you use a Block Part as a HitBox, so it wouldn’t have weird shapes.

I see, then that could be an option for the Users to choose which type of Ray they want to use depending on the performance they want.

29 Likes

Can confirm, also went to an art school. Even Michelangelo will tremble at your pure brilliancy. Picasso lovers, watch yourself.

I do like the idea of vertical rays, in a way people can sacrifice accuracy for more performance so you’re right. Regarding block part as a hitbox, I suppose something like an irregular scythe weapon where the angles aren’t always rectangular and you want something especially accurate, it might not work but for most common use cases, I can see it working like you described.

18 Likes

Awesome module, however before i am going to use this ill be waiting for some more events to come out. I am currently creating lightsabers and i need the onhit event. So definately using this in the future!

10 Likes

New Update: V.1.1

Hey all, just updated some minor but beneficial changes to the module. You can read more in the “How To Use” and “Update Log” in the main thread if you want to know the changes. Thank you to those who have helped thus far, it was a great learning experience. I will keep updating it and optimizing as need be (and as much as I can within my limited timeframe!)

In summary, the Initialize function now returns a HitboxObject which you can use HitStart or HitStop on. It also has a new onhit function (example in the main thread). I’ve filled out some more information directly in the module, and the HitStart and HitStop used directly on the RaycastHitboxModule is deprecated (so use the returned HitboxObject instead). This variable system also allows you to manage multiple hitboxes, a good example is if you have a dual wielding sword character, you can disable hitboxes for one of the swords while keeping the other off hand on.

22 Likes

How computationally expensive is this? It doesn’t look too bad, but I imagine swords with large hitboxes (and many of them) would have a lot of overhead.

Very nice work :slight_smile:

10 Likes

There are definitely room for improvements, but from what I’ve tested, the performance was a lot better than using Region3 and Touched (in large quantities). The ShieldNSword npc above stretched about 181 raycasts a frame, and even in live production games with a plethora of other computation happening, server was still very smooth, fps drops were minimal, and this is also tested with multiple SwordNShield npcs at once. Though, if you’re really worried, it doesn’t hurt to test it out yourself.

Edit: Most games dont really have oversized swords, so honestly you should be doing 7 - 15 attachments per weapon, 1 stud apart for the most efficiency. It takes hundreds of rays a second to even consider performance drops.

13 Likes

For some reason, was not efficient on my testing.
There are a few points you should certainly consider for next update.

  1. Ignore should automatically include the terrain.
  2. Support for multiple hitboxes, such that sword skill hitboxes are bigger than normal attack hitboxes
  3. have damage with initialize function? Instead of passing it, every time you attack, you could have it set in the metatable.

If possible could you share a sword model that contains the sword (or any other free model scripted with this module) so that we could see how you require the module etc?

However, all in all, this module is really amazing and I appreciated trying it out, thanks!

What I’m currently using for touched event is setting a loop that gets the touching parts of a non-cancollide part in the tool, representing hitbox.

7 Likes

Thank you for your insights. What performance problems were you encountering in particular? I can probably do a quick mockup example later for you.

Regarding 2., V.1.1 should have support for multiple hit boxes, you just need a separate model containing those new attachments and then call initialize on that one. Unless I’m not understanding what you’re requesting then I apologize.

9 Likes

The raycasts are from old point to current point, yes?

If so, then rather than attachments there should be an option to pass a table of positions and a root part to do said positions relative to. This would reduce instance management and be preferable in my opinion.

7 Likes

Yeah, I edited the script so that the sword has is made of tables, each one being the hitbox.
And regarding performance, I believe the number of parts or the number of raycasts created/calculated were the reason for the lag.
Would really appreciate a quick example tool, thanks!

7 Likes

What was your setup? You’re usually capable of firing off hundreds of rays per frame without performance hits as short rays at inexpensive. Seems like a concern to me that you were experiencing performance hits with this, since to my understanding it does exactly that (short rays per frame).

7 Likes