Raycast Hitbox 4.01: For all your melee needs!

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

So, I was making this Module work with my game and I stumbled upon something weird, in the API it says " RaycastHitModule:GetHitbox" but what is “RaycastHitModule” since when we’re talking about the main module, above it’s referred to “RaycastHitbox” I tried using the function GetHitbox() on the “RaycastHitbox” module but it returns a nil value, even though the hitboxes initialize successfully. Please help.

Its an old function that I forgot to add back in when I revamped the module. The newest version, v2.2 is available on my github that fixes the missing function so you can download it there. I will update it on the actual site soon.

Alright, thank you. I love the module btw, It’s really easy to adapt from old .Touched Hitboxes. :+1:

1 Like

Ok, so I stumbled upon another weird thing, when I initalize the hitboxes that I’m going to use, and call them using the :GetHitbox() function, it creates them again? I only call the initalize function once, and when I execute the attack it warns me that “This hitbox already exists”, even though it’s not initializing it again. I’m using Hitbox:HitStart() and Hitbox:HitEnd() only, so I don’t know what causes this issue. This glitch is very problematic, since it creates the Hitboxes, and they stack over and over dealing progressively more damage upon reaching the point of a one shot kill.

Doesn’t sound like an issue with the hitbox function but are you forgetting to disconnect the OnHit when you are done with HitStop()? You are creating a new thread when you run the connection line but it is difficult to diagnose if you don’t provide sample code.

1 Like

My bad, I didn’t know you had to disconnect it, it worked, thanks.