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??
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.
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
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
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?
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?