Raycast Hitbox 4.01: For all your melee needs!

Im having a problem with RayCastParams. here is my script:

local RayC = require(game:GetService("ServerScriptService").RaycastHitboxV4)
local partDetection = RayC.new(part.Parent.Collide)
	
local RParam = RaycastParams.new()
RParam.FilterDescendantsInstances = {game.Workspace.Folder}
RParam.FilterType = Enum.RaycastFilterType.Blacklist
	
partDetection.RayCastParams = RParam
partDetection.DetectionMode = 2
	
partDetection:HitStart()
partDetection.Visualizer = false

the script still returns objects within the folder I specified not to return from.

The raycast is actually offset

It only happens after I teleport the player or the glove

Yes. I used this, works great.

In our previous implementation we were destroying hitboxes to avoid overloading the client with non usable parts. We have a fair amount of melee weapons in our game and I thought it would be optimal to destroy the raycast hitboxes after a hit. Was that mindset wrong??

So you are creating a hitbox to check for a hit, then destroying it when it hits, then creating another one?

There’s a huge problem with RaycastHitboxV4 and its OnHit bindable.

When you print the name of the part hit in the module, and then print what it receives in a localscript, it will not return all parts that the module found and hit, therefore missing a good chunk of what the raycast actually hit

RaycastHitboxV2 has a more responsive OnHit bindable for some odd reason, as I’ve experimented with; Compared to RaycastHitboxV4, V2 will return EVERY single part it hit from the module to the localscript. Why is that?

Also, if anyone has trouble getting responsive hits with swordphin’s hitbox, consider replacing the raycast with GetPartsBoundInRadius for each attachment, it’ll become much more responsive than raycasts due to the slightly extra detection range

I edited swordphin’s V2 version below with GetPartsBoundInRadius for anyone who wants to test
SwordphinMagnitudeHitboxV2.rbxm (8.8 KB)

In the previous implementation it was like this, we were creating a part in front of the player, damaging players that were into it and then destroying that part, but that was a really bad idea for hitboxes that’s why we decided to choose this module.

I followed the same mindset, but we ended up with that error, and a playtesting session we had ended up with the game crashing. Based on your previous comment, now I’m activating the rays (HitStart) when the power is cast (i.e. when someone is swinging the sword) and then stopping the rays (HitStop). Didn’t see the bug appearing again but we might have to do another playtesting session with lots of people.

1 Like

what the hell is happening, help
(Sorry for the low quality)



2 Likes

I’m confused, I don’t see something wrong, unless you’re talking about the animation. The hitbox seems to be doing its job, but the animation is jittering.

The jittering of the animation is just the lag of the recording, the problem is that sometimes I hit an npc that is like 1 stud from the hitbox
You can see it cleary in the first video
here’s an image of the problem
image

awesome!
Helped greatly with my game :+1:

Can anyone help me with this?
idk why but for some reason the raycast hitbox is bigger than the rays
image

6 Likes

Editted: I already found a solution I was just being lazy and did it completly wrong lol.

Great module it’s really really handy and it really helps me getting into melee combat stuff! Thanks for this awesome module!!!

Is there a way to detect if you hit a part without a humanoid? For example here’s a script I’m trying to do that with:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RaycastHitbox = require(ReplicatedStorage.RaycastHitboxV4)

local swordHitbox = RaycastHitbox.new(script.Parent)

swordHitbox.OnHit:Connect(function(hit,humanoid)
	print("hit")
	local model = hit.Parent
	print(model.Name)
	if model.Name == "Burger" or model.Name == "Taco" then
		if model.ClassName == "Model" then
			local health = model:GetAttribute("Health")
			health = health-100
			model:SetAttribute("Health", health)
		end
	end
end)

while true do
	swordHitbox:HitStart()
	wait(3)
	swordHitbox:HitStop()
	wait(3)
end

Shouldn’t Taco be +100 because they are yummy?

Is anything showing up in output?
What is it you are hitting?
Are all models going to have health in them? Or does it error out when you click a model without Health?

If you add a print statement debug inside of the if, does it print when you whack a taco?

4 Likes

Nothing is showing up in the output. I am hitting a part in the model, which should either be named Taco or Burger. Only the Taco and Burger models have a health attribute. It’s not even printing the hit at the beginning. Is what I want to do not even possible with the current version?

How do I access this? I don’t see any documentation in the script.

Is there a way to make hitboxes detect each other?

When the fps is lower, or if you are spinning, the hitbox size is increased for some reason.