Hello there!
First, I would like to commend all that youāve done in regard to the provision of this system to the community, and it is the best material Iāve found on this forum!
I just have an issue pertaining to the hitbox, which is attached to a humanoid in a model of mine. Essentially, I have a range of DmgPoint attachments within a hitbox part, but Iām struggling to prevent self-inflicted damage while also enabling damage to those who collide with the attachments thereof. I was hoping you would be able to solve this problem!
Below is the hitbox Iām referring to
local ClientCast = require(game.ServerStorage.ClientCast)
for i = -2.5, 2.5, 0.1 do -- Creating new attachments called "DmgPoint" within the -2.5 and 2.5 range every 0.1 stud on the Y-axis
local Attachment = Instance.new("Attachment", game.Workspace.MALWARE.CorruptionAura)
Attachment.Name = "DmgPoint"
Attachment.Position = Vector3.new(0, i, 0)
end
for j = -2.5, 2.5, 0.1 do
local Attachment = Instance.new("Attachment", game.Workspace.MALWARE.CorruptionAura)
Attachment.Name = "DmgPoint"
Attachment.Position = Vector3.new(1, j, 0) -- Note the changes to the attachment positions (X = 1)
end
for k = -2.5, 2.5, 0.1 do
local Attachment = Instance.new("Attachment", game.Workspace.MALWARE.CorruptionAura)
Attachment.Name = "DmgPoint"
Attachment.Position = Vector3.new(-1, k, 0)
end
for l = -2.5, 2.5, 0.1 do
local Attachment = Instance.new("Attachment", game.Workspace.MALWARE.CorruptionAura)
Attachment.Name = "DmgPoint"
Attachment.Position = Vector3.new(-2, l, 0)
end
for m = -2.5, 2.5, 0.1 do
local Attachment = Instance.new("Attachment", game.Workspace.MALWARE.CorruptionAura)
Attachment.Name = "DmgPoint"
Attachment.Position = Vector3.new(2, m, 0)
end
for n = -2.5, 2.5, 0.1 do
local Attachment = Instance.new("Attachment", game.Workspace.MALWARE.CorruptionAura)
Attachment.Name = "DmgPoint"
Attachment.Position = Vector3.new(0, n, -0.5)
end
for o = -2.5, 2.5, 0.1 do
local Attachment = Instance.new("Attachment", game.Workspace.MALWARE.CorruptionAura)
Attachment.Name = "DmgPoint"
Attachment.Position = Vector3.new(-1, o, -0.5)
end
for p = -2.5, 2.5, 0.1 do
local Attachment = Instance.new("Attachment", game.Workspace.MALWARE.CorruptionAura)
Attachment.Name = "DmgPoint"
Attachment.Position = Vector3.new(-2, p, -0.5)
end
for q = -2.5, 2.5, 0.1 do
local Attachment = Instance.new("Attachment", game.Workspace.MALWARE.CorruptionAura)
Attachment.Name = "DmgPoint"
Attachment.Position = Vector3.new(1, q, -0.5)
end
for r = -2.5, 2.5, 0.1 do
local Attachment = Instance.new("Attachment", game.Workspace.MALWARE.CorruptionAura)
Attachment.Name = "DmgPoint"
Attachment.Position = Vector3.new(2, r, -0.5)
end
local Caster = ClientCast.new(game.Workspace.MALWARE.CorruptionAura, RaycastParams.new()) -- Creates new clientcaster
local Debounce = {}
local MALWARE = script.Parent.Parent
Caster.HumanoidCollided:Connect(function(Result, HitHumanoid)
if Debounce[HitHumanoid] then return end
Debounce[HitHumanoid] = true
local Hit = Result.Instance.Parent
if Hit ~= "MALWARE" then -- Here is the area of focus ... how ensure damage to any humanoid, while also preventing MALWARE's humanoid from being damaged?
HitHumanoid:TakeDamage(20)
wait(0.33)
Debounce[HitHumanoid] = false
end
end)
Caster:Start()
Iāve tried scrolling through this hefty discussion, and I havenāt seen anything pertaining to ā3D hitbox cubesā.
Thank you