I actually changed some things around last night and it started working with Animation.Length. Not sure why it started working but I’m still using Animation.Length so everything is good.
Also wanted to say that I really love your module so far, it’s a really cool way to do melee hit detection. I plan to make my melee combat system with your module. One thing I would love to see in the future is support for the ability to hit multiple humanoids in one attack, instead of stopping at just the first target hit? Not sure if this is possible to do with the way your module works though. Thank you for releasing this and being so quick at replying
Another thing is I tried to use your new RemovePoints function, but points don’t seem to remove correctly? Each punch should do 10 damage on the humanoid, but as you can see below, they just add up instead:
https://gyazo.com/3542b50331cc26d9c32795ca74b5473b.gif
Here’s the way I coded it:
local Hitbox = RaycastHitbox:Initialize(Character, {Character})
local function RightHandPoints(Hitbox, Bool)
if Bool then
Hitbox:SetPoints(RightHand, {
Vector3.new(0, 0, 0),
Vector3.new(0, -0.1, 0),
Vector3.new(0, 0.1, 0)
}
)
Hitbox:SetPoints(RightLowerArm, {
Vector3.new(0, 0, 0),
Vector3.new(0, -0.1, 0),
Vector3.new(0, 0.1, 0)
}
)
RightPunch:Play()
else
Hitbox:RemovePoints(RightHand, {
Vector3.new(0, 0, 0),
Vector3.new(0, -0.1, 0),
Vector3.new(0, 0.1, 0)
}
)
Hitbox:RemovePoints(RightLowerArm, {
Vector3.new(0, 0, 0),
Vector3.new(0, -0.1, 0),
Vector3.new(0, 0.1, 0)
}
)
end
end
local function LeftHandPoints(Hitbox, Bool)
if Bool then
Hitbox:SetPoints(LeftHand, {
Vector3.new(0, 0, 0),
Vector3.new(0, -0.1, 0),
Vector3.new(0, 0.1, 0)
}
)
Hitbox:SetPoints(LeftLowerArm, {
Vector3.new(0, 0, 0),
Vector3.new(0, -0.1, 0),
Vector3.new(0, 0.1, 0)
}
)
LeftPunch:Play()
else
Hitbox:RemovePoints(LeftHand, {
Vector3.new(0, 0, 0),
Vector3.new(0, -0.1, 0),
Vector3.new(0, 0.1, 0)
}
)
Hitbox:RemovePoints(LeftLowerArm, {
Vector3.new(0, 0, 0),
Vector3.new(0, -0.1, 0),
Vector3.new(0, 0.1, 0)
}
)
end
end
CombatRemote.OnServerEvent:Connect(function(Player, Info, Plr)
if Player.Character.Properties.Move.Value and not MeleeDebounce and Player.Name == Plr.Name then
MeleeDebounce = true
Hitbox.OnHit:Connect(function(Hit, Humanoid)
if Humanoid.Health > 1 then
local Move = Humanoid.Parent.Properties.Move.Value
local HumanoidRootPart = Humanoid.Parent.HumanoidRootPart
Humanoid.AutoRotate = false
if Humanoid.Health - Damage > 1 then
Humanoid:TakeDamage(Damage)
Humanoid:MoveTo(HumanoidRootPart.Position + -4 * HumanoidRootPart.CFrame.lookVector)
local Punched = Humanoid:LoadAnimation(PunchedAni)
Punched:Play()
else
Humanoid.Health = 0.01
print("Dead")
end
Move = false
wait(0.3)
Move = true
Humanoid.AutoRotate = true
end
end)
local Hand
local Animation
if Info == "Right" then
RightHandPoints(Hitbox, true)
Hand = RightHand
Animation = RightPunch
elseif Info == "Left" then
LeftHandPoints(Hitbox, true)
Hand = LeftHand
Animation = LeftPunch
end
local Time = Animation.Length
Hitbox:HitStart()
wait(Time)
Hitbox:HitStop()
if Info == "Right" then
RightHandPoints(Hitbox, false)
elseif Info == "Left" then
LeftHandPoints(Hitbox, false)
end
MeleeDebounce = false
end
end)
Edit:
Here’s another issue I discovered:
https://gyazo.com/a4a4aa2eea8904ef44792dc34f64aad0.gif