Raycast Hitbox 4.01: For all your melee needs!

Hey just thought I’d let you know. The documentation in the module includes a “GetHitbox” function which doesn’t exist in 2.1. Here’s the addition I added to the main module for the time being (it causes a warning in check to be fired so I commented that out as well).

function RaycastHitbox:GetHitbox(object)
   return Handler:check(object)
end
4 Likes

is there a way i can make this detect things other than humanoids? making a melee system that both deals damage and breaks walls.

1 Like

Have you tried PartMode? It basically turns it into touched by activating onhit per part hit.

1 Like

cheers, thats just what i needed

1 Like

This is a wonderful starting point for your game! Good job :smiley:

1 Like

Hey dude @TeamSwordphin !

Roblox added a new feature New RaycastParams Property, Deprecating Old Raycast Functions

If you need help with putting this Module on Github let me know

5 Likes

We use RaycastHitbox extensively in our current project (PWNED 3, from which some of the images in the OP come from). I could probably take this up part up with Phin since we did touch on GitHub (and Rojo) and may potentially also releasing other resources for developer use.

* Rojo was brought up internally as something to look at, but not sure if we’re moving over.

Also, noticed you brought GitHub up a few times lol. I think it’d be awesome to have this up on GitHub as well. Appreciate the heads up and enthusiasm. :sunglasses:

3 Likes

@RuizuKun_Dev @colbert2677

I’m still learning the crux of github but so far it seems pretty straightforward. I haven’t fidgeted around with any of the permissions yet so do let me know if there is anything else that needs to be done.

5 Likes

I have an issue.


Why aren’t the attachments following through with the arm?
Rays are being cast server-side, would that be an issue?
Also, the animation doesn’t play the server-side…
So if I played it on the client, it would work, I assume?

2 Likes

Animations not playing on the server side is the problem yes. Since the attachments are also on the server, it won’t move because its following the animations on the server. It will be fixed if you move it client sided (assuming that model is a player). Remember to do server side sanity checks if you do.

2 Likes

Okay, how would I do a sanity check with a remove event? I’m already checking if the humanoid is existing, wouldn’t that be it?

1 Like

An example of basic sanity check is: make the client do all the hit detection with this module. Once the client hits a humanoid, send a remote event to the server essentially telling the server to damage this humanoid it hit.

The server won’t immediately damage the humanoid. Instead, it will verify first if it is valid. A simple way is to do a raycast between the hit humanoid and the player that called the remote event. If there is a wall between them, don’t damage the humanoid (because you’re not suppose to damage stuff through walls anyway!) Another sanity check you can combine it with are magnitude/distance checks. If the player says to damage a humanoid but that humanoid is 500 studs away, this is already a red flag. It’s basically just seeing what makes sense in your game and making sanity checks according to that. I recommend searching around the devforum as well for what makes good server side security against exploiters.

4 Likes

So I would send my own raycast, not using your module, to check if there is an object between the two?

1 Like

Correct. Once the server validates that all your checks are 100% okay, then it will deal the damage.

2 Likes

Hello! I’m here to ask on how it works, because I’d like to make my own one so I can understand the script. I used to use touch event which is know for being a unreliable way to do so, so I wanted to try this, but i can’t find any examples of how it functions. Thank you in advanced!

2 Likes

Why Raycasting over Touched, Region3, etc… ?

In all honesty, I have never heard of developers using Region3 as a hitbox for melees. I’ve just started learning the basics of Region3, and that sounds insanely complicated and too complex.

It makes sense given what it does, but it just sounds like too much work and impractical.

Region3 is fast but cannot be rotated (egomoose cough)
Touched is inconsistent and useless if you’re CFraming

1 Like

could you please post an example as to how you use linkattachments in a script?

im struggling so much right now… lol.

The sample roblox place provided in the original post has a link attachments example. I wouldn’t recommend using it over the normal raycasting system if you are using it for swiping melee attacks, but it has its niche cases.

An example code can be:

local RaycastModule = require(RaycastHitboxModule)
local Hitbox = RaycastModule:Initialize(workspace.Part)

local Attachment1 = Instance.new("Attachment", workspace.Part)
local Attachment2 = Attachment1:Clone()
Attachment2.Position = Vector3.new(0, 20, 0)
Attachment2.Parent = workspace.Part

Hitbox:LinkAttachments(Attachment1, Attachment2) --- Links a raycast location between the two attachments

Hitbox:HitStart() --- Starts the damage logic, will continually raycast between the two points defined above
2 Likes

thanks i apreciate it.

this is actually what i made using linkedattachments:

https://i.gyazo.com/5698dc36f0a36ebe63b7613aad9d780f.mp4

basic hand-hand combat, i felt that in this case linkedattachments would be more suitable for my needs… little did i know it came out better than i expected.

me and alot of others really appreciate this module, keep doing what you’re doing.

2 Likes