Raycast Hitbox 4.01: For all your melee needs!

Has anyone else gotten a bug where cloning a part that currently has a hitbox, applying a hitbox to the cloned part, then destroying the hitbox on the part that was cloned from? Usually results in the hitbox on the cloned part returning as nil.

I can’t say for certain, but if I had to guess I’d say you were casting the hitbox on the server. For more smoothness, try casting it on the client and then performing sanity checks on the server (is the hit object close enough, is it unobstructed, etc.) to make sure any detected hits are valid.

1 Like

Hey! I’ve been using this module for almost a year, but now I have this issue: I’m casting a hitbox (a short one, ~0.5 seconds long) in a tweened part (it is actually in a tool, which is in a tweened character) and the hitbox seems pretty delayed (I enabled visualizer), it isn’t even THAT quick (3 studs forward in, as I said, ~0.5 seconds).

There is any way to fix this or making the hitbox update quicker? I think that client casting is way too risky.

EDIT: also, just discovered another big issue which is that hitbox is not starting, I think this is happening because of this is a combo (which can be up to 2 hitboxes per second, each one 0.5 long), but I’m not sure since the hitbox is actually stopped before the next one in started (I already used some prints and similar to check); seems to be fixed if I stop the hitbox sooner, but anyways this shouldn’t happen (since I’m literally also stopping the hitbox right before starting a “new” one).

Thank you for reading!

Sorry in advance if this post doesn’t help you, but 3 studs forward in about half a second is pretty damn quick. Casting this on the server would more likely than not lead to it looking delayed on the client. As far as I know, fixing this problem directly (making it appear faster to the client while still casting on the server) is impossible.

Taking a blind guess, but if you are making something similar to a barrage / quick attack, a better option (that you can still do on the server) would be to use spatial queries. Although it’s not as precise, it is still much faster even on the server, and for an attack as quick as that, I’d doubt a player in full range would be able to dodge in about half a second.

1 Like

Hey! I’m sorry for my previous reply, I thought you were actually replying to another topic of mine.

I don’t know anything about spatial queries, do you have some API or topic to read more about it?
I guess the other options are: part hitbox (which I hate but may fit more this new type of game I’m thinking about) or .Touched.

Thank you for replying!

1 Like

You can read more about it here Introducing OverlapParams - New Spatial Query API - Updates / Announcements - DevForum | Roblox


Thanks, this will really help me with a sword system I am making! :slightly_smiling_face:

if you have a debug setting, it’s gonna hide the hitbox

Is it possible to create static rays as a replacement to hitboxes, while keeping the same functionality instead of making the hitbox move with the weapon?

Can it be used to detect a part, not just a humanoid? For example, when the player uses a sword and hits a wall, can the OnHit event know that it hit a wall?

Edit: OK i found out

How would i detect where raycast has collided with a part so i can place a particle emitter at position where it collided?

yep, you can use the PartMode

1 Like

I’m already using PartMode though. Oh wait, nevermind I was using Default lol

Is it just me, or is the “OnHit” event pretty unreliable for constantly active hitboxes. I have a forever lingering hitbox that is just there to detect a specific part, but its detection stops working when any other hitbox collides with that part. Refreshing the hitbox via HitStop and HitStart doesn’t seem to fix the problem either. Keep in mind that this is all client side. I’ve done my best to ensure it wasn’t my code that was dropping the signal, and I’ve found out that the raycast still detects the part, but the “OnHit” event simply doesn’t fire. And yes, I have the signaltype set to “Default”, so that it fires to multiple connections. As of now, I’m somewhat sure this is a bug, perhaps a byproduct of “GoodSignal”, nevertheless I hope you can get back to me on this @TeamSwordphin.

Try changing the DetectionMode.

Yeah, It’s always been set to “Bypass”. As I said, I’m pretty sure this is a bug with something related to “GoodSignal”.

Has anyone experienced an error similar to this?? I’ve been trying to integrate the module in our game for our melee weapons, works great as far as hit detection goes but this error keeps popping up sometimes. I can’t figure out a pattern as to why it’s appearing. Can anyone shed some light on this??

I’m creating a hitbox based on the SetPoints function and I’m destroying it after a while. The main issue is that the Hitbox:Destroy() function sometimes is working properly, other times this error appears.

If more information are needed, please let me know!

Hello! I’m having issues with getting the hitbox to ignore players. I am trying to get it to ignore all players, but still hit and deal damage to NPCs. How would I go about defining that? Any help would be much appreciated!

make all players on the same team

1 Like

Whenever I teleport the tool, or the player with the tool even though it shows in the workspace that the attachments are still on the tool it shows the raycasting done from far away, how do I fix this?