You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
a hitbox that works properly -
What is the issue? Include screenshots / videos if possible!
hitbox hitting targets weirdly -
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
i havnt tried any cuz im not very familiar with hitboxes
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local HitboxModule = {}
local Fx = workspace.Fx
local isFront
function HitboxModule.NormalHitbox(size, cframe, ignore, char)
local hitbox = Instance.new("Part", Fx)
hitbox.Size = size
hitbox.CFrame = cframe
hitbox.Transparency = .5
hitbox.Material = Enum.Material.ForceField
hitbox.Color = Color3.new(1, 0, 0)
hitbox.CanCollide = false
hitbox.CanTouch = true
hitbox.Massless = true
hitbox.Anchored = false
hitbox.Name = "HitBox"
local weld = Instance.new("WeldConstraint", hitbox)
weld.Part0 = char.HumanoidRootPart
weld.Part1 = hitbox
local hitTarget = nil
local ignoreSet = {}
for _, v in pairs(ignore) do
ignoreSet[v] = true
end
local partsinsideofhitbox = workspace:GetPartsInPart(hitbox)
local function onHit(part)
local parent = part.Parent
if parent:FindFirstChild("Humanoid") and not ignoreSet[parent] then
if part.Name == "HumanoidRootPart" then
local dot = char.HumanoidRootPart.CFrame.LookVector:Dot(part.CFrame.LookVector)
if(dot >= -1 and dot < 0) then
isFront = true
else
isFront = false
end
end
hitTarget = parent
end
end
for _, v in pairs(partsinsideofhitbox) do
onHit(v)
end
--task.wait(.1)
weld:Destroy()
hitbox:Destroy()
return hitTarget, isFront
end
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.