Can I see how you did your attachments? This module works a lot better with animations that “follow-through” much more, such as swords. Make sure your animations don’t collide with your targets too (meaning if you punch something, it doesn’t push you away). I would even consider extending the hitbox outside of the arms so any potential physics mishaps won’t interfere.
I think that hitbox still looks a bit too small. But if you’re are still having problems, perhaps you can try sending me a barebone version of your place with the animations and rig so I can diagnose it further for you.
Oh I actually think I managed to fix it by using :HitStop() a bit after the time the animation stops at bc I didnt encounter any more issues after that but since the red ray actually passed in my recent version through the arm I think there might be still an issue, not sure, but for now it seems to have been fixed and that the issue was on my part bc I used :HitStop() too soon
I’d still like to send you the place so if I missed anything you’d be able to point it out, I’ll dm you it.
Hi, Swordphin123!
Thank you for updating the module.
I also think you should put the Module on Github so we can help you maintain it!
Can I just pass a MeshPart (which in my game is the weapon) or do I have to pass a model with the Weapon inside?
I’d suggest using it on both, this may sound funny.
You should use it on the client for all of the effects, and such. Have the server process the actual stuff to make sure it’s a legitimate attack.
My later replies do recommend using it on both or a hybrid of sorts. Not a funny, its totally a thing and I agree with you!
@RuizuKun_Dev I’m not actually sure how to use github. If I find the time, I definitely will put it up!
@DorksuRBX Any instance will do.
Any idea why mine isn’t working? The OnHit function never runs. The code below runs every time the Player left clicks.
- Have you first confirmed the debug rays to be drawing? Anything unusual in the output?
- Is there a reason you are deinitializing the hitbox? This will invalidate HitStart and HitStop the next time you use them, making them no longer work. Unless this attack only happens once, I would just recommend leaving HitStop in only.
local Hitbox = RaycastHitbox:Initialize(Character.Weapon, {Character})
Removing the second argument fixed the issue, so I assume the second argument is a whitelist (your API says it’s an ignorelist but that doesn’t seem to be the case).
And I deinitialize the Hitbox bc of how I’m handling my combat.
P.S I’d suggest making it so that we can choose if we want to see your Warns or not - I’ve commented all of them now as I don’t need to see them anymore. If Debug is true, the Warns should be outputted, if Debug is false then they shouldn’t.
The second argument is a blacklist. You can confirm this by looking at the raycastParams in hitbox object. That really shouldn’t be affecting it unless your “character” has all the enemies grouped together.
Seems to be fixed now, not sure why it wasn’t working properly before.
Hey I only really have one question/problem how did you get the rays to follow the sword with a dash? (EX: )
When I try using body velocity for a dash the rays stop before reaching the end, and I stop the casting right when the animation ends. (EX: https://gyazo.com/9f43378d5384184a6d7498c8b46ad706 )
Are your rays server or client sided? Normally this only happens if your rays are server sided. Its because the server has a slight delay on where the actual player position is. My NPC doesn’t have that problem because his rays and his actual model is already on the server so they will always be in sync.
Try making the hitbox longer (maybe past the length of your legs). The sword hitbox has rays being drawn slightly ahead of as well.
Yep the problem was the rays being server side, I spent time changing it and now they follow well, only concern is potential lag due to the rays somewhat spamming Remote Events, but should be fine.
Hey man, Im using your module and the raycasts are going all crazy. The HitBox only fires sometimes and is inconsistent. I already tried to extend the time until HitBox:Stop() fires but i get the same results. Any ideas?
local Damage = 30
local RayHitBox = HitBox:Initialize(Character,{Character})
RayHitBox.OnHit:Connect(function(hit, oppHum)
print(hit.Parent.Name)
oppHum:TakeDamage(Damage)
end)
vPunch1:GetMarkerReachedSignal("Start"):Connect(function()
FaceOpponent()
RayHitBox:HitStart()
end)
vPunch1:GetMarkerReachedSignal("Ended"):Connect(function()
dPunch1 = false
Continue = false
RayHitBox:HitStop()
end)
How are your attachments setup? It merely follows the attachment instance position (or setpoints position). Verify you aren’t moving the attachments away in the workspace while you are playtesting.
They run along my arms as you would expect. I even made the fist attachments stick out just to make sure they would hit the npc, but they don’t. Also they do not move unexpectedly during playtesting.
Can you DM or share the model to me containing the attachments? Your code looks fine to me.