Basically, I had a decently made hitbox system, but in recent events I thought about making a Running Punch, and the chance of it not being responsive, so the goal was two things.
- Make the Hitbox Multi-Hit.
- Make the follow the character around.
Now, I achieved the second result for a split second before it just bailed and failed on me but that’s not relevant
My hitbox is failing to detect, even though, 1. It’s hitting a characters hitbox, 2. it’s using the same setup as the previous script that works. Now the primary issue, seems to be that the table i’m sending to create said hitbox, seems to not be detecting a single thing.
local function CreateHitbox(self)
return workspace:GetPartBoundsInBox(self.UpdatedPosition, self.Size, HitboxModule.OverlapParams)
end
local function Detection(self, Table : { }, MaxHitCharacters : number)
if MaxHitCharacters > 100 or MaxHitCharacters < -1 then
MaxHitCharacters = 5
end
local DamageTable = {}
local CharacterCount = 0
if CharacterCount >= MaxHitCharacters then print("u picking too many chars") end
if CharacterCount <= MaxHitCharacters then print("u picking too little many chars") end
print(Table)
print(self)
for _, PlayerGettingHit in pairs(Table) do
print(Table)
if CharacterCount >= MaxHitCharacters then print("u picking too many chars") break end
print(self)
if PlayerGettingHit then
print("ur broke")
end
if PlayerGettingHit:FindFirstChildOfClass("ObjectValue") then
print("ur broker")
end
if PlayerGettingHit.Char.Value ~= self.Attacker then
print("ur the brokiest")
end
if PlayerGettingHit.Char.Value ~= self.Attacker then
print("no money")
end
if PlayerGettingHit and PlayerGettingHit:FindFirstChildOfClass("ObjectValue") and PlayerGettingHit.Char.Value ~= self.Attacker and PlayerGettingHit.Char.Value ~= self.Attacker.Parent then
print("yea we good")
CharacterCount += 1
local eChar = PlayerGettingHit.Char.Value
print(eChar)
local enemyHum = eChar.Humanoid
if enemyHum then
print("yippie")
if enemyHum.Health > 0 then
table.insert(DamageTable, eChar)
end
end
end
end
return DamageTable
end
Hitbox.LastingTime = Clock() - Hitbox.BeginningTime
Hitbox.InUse = true
if typeof(Hitbox.OriginalPos) == 'Instance' then
Hitbox.UpdatedPosition = ClientPredPosUpdater(Hitbox)
else
Hitbox.UpdatedPosition = Hitbox.OriginalPos
end
local Hit = Detection(Hitbox, CreateHitbox(Hitbox), 10)
print(CreateHitbox(Hitbox))
For context, the prints might be off one or two, but no more than I believe.
The biggest issue is the fact that, 1. I’m hitting a character, and 2.
for _, PlayerGettingHit in pairs(Detection) do
if PlayerGettingHit and PlayerGettingHit:FindFirstChildOfClass("ObjectValue") and PlayerGettingHit.Char.Value ~= AimedInd and PlayerGettingHit.Char.Value ~= AimedInd.Parent then
local eChar = PlayerGettingHit.Char.Value
local enemyHum = eChar.Humanoid
if enemyHum then
if enemyHum.Health > 0 then
return true ,eChar
end
end
end
end
The only thing is that it’s not getting ran every frame, and there’s an actual part object. So, this pretty confusing, since these are nearly uncanny in similarities. If you need to see further for the first hitbox because the abstraction leaves out important details, just let me know.