I am trying to make a Hitbox class but for some reason the hitbox part is not detecting anything with the :GetTouchingParts()
I have tried doing this witht he Default collision group. does anyone see anything that would cause this to stop working. I am just trying to detect a player/npc
function Hitbox.cast(self: HitboxClass): {BasePart}
if self.info.shape == "Box" then
local hitbox: BasePart = Instance.new("Part")
hitbox.Parent = workspace
hitbox.Name = "Hitbox"
hitbox.Size = self.info.size
hitbox.CFrame = self.attatchedTo.CFrame * CFrame.new(self.info.offset)
hitbox.Orientation = self.attatchedTo.Orientation + self.info.rotation
hitbox.CanCollide = false
hitbox.CanQuery = true
hitbox.CanTouch = true
hitbox.Anchored = true
hitbox.CollisionGroup = self.info.collisionGroup
if DEBUG then
hitbox.Transparency = 0.9
hitbox.Color = Color3.new(1, 0, 0)
hitbox.Material = Enum.Material.Neon
else
hitbox.Transparency = 1
end
local parts = hitbox:GetTouchingParts()
print(hitbox)
print(parts)
print(hitbox.CollisionGroup)
if not DEBUG then hitbox:Destroy() end
return parts
end
end