Hey! I just finished fixing this script after a unreasonably long time and I found out two bugs.
The damage will randomly be high (triple the amount). My button script does make the hitbox be created 3 times, but each time it's 18 instead of 6.
Touched event only fires when parts are moving (I know this is how it works, but now I can't use it for this)
The Touched event can't be used in this situation because if the victim is standing still, they take no damage. People have suggested Raycasting or Region3, but it seems like it's not only more time consuming, but kinda hard to use (along with it being a bit more laggy if I was to make every hitbox Raycasting in an 8 player game). I've tried Unanchoring the hitbox so it can detect when it hits a player, but this seems like it would cause minor problems with the hitbox not being in the perfect spot. All of this and I still have a minor problem with damage and why it's being done more than once. Does anyone know a better way to make a hitbox that avoids these problems? Heres my current code:
The damage:
local part = game.ReplicatedStorage.ClassData.Bloxxer.BloxxerSword:Clone()
local P = script.Parent
local fire = game.ReplicatedStorage.MoveSetFires
local A = P.ATK
local AF = fire.Attack
local A1 = P.AB1
local A1F = fire.AB1
local A2 = P.AB2
local A2F = fire.AB2
local RJ = P.REJ
local RJF = fire.Rejuvinate
local CORE = P.BTZ
local CF = fire.Core
local Attackcd = false
local AtCD = .8
local function createhitbox(size1, size2, size3, damage, tim, offset, player)
local sword = player.Character:WaitForChild("BSword", math.huge)
local hit = Instance.new("Part")
hit.Size = Vector3.new(size1,size2,size3)
hit.Color = Color3.new(200,0,0)
hit.Transparency = .6
hit.CFrame = player.Character.HumanoidRootPart.CFrame:ToWorldSpace(CFrame.new(0,0,offset))
hit.CanCollide = false
hit.Parent = workspace
local destroy = coroutine.create(function()
wait(tim)
if hit then
hit:Destroy()
end
end)
coroutine.resume(destroy)
hit.Touched:Connect(function(h)
if h ~= player.Character.Humanoid or player.Character.HumanoidRootPart or player.Character then
local humanoid = h.Parent.Humanoid or h.Parent:FindFirstChildOfClass("Humanoid")
print(h)
humanoid.Health = humanoid.Health - damage
hit:Destroy()
end
end)
end
print("okok")
AF.OnServerEvent:Connect(function(player)
if player then
--the hitbox
createhitbox(3.1, 2.45, 7.25, 6, .1, -8, player)
end
end)
The other script is the one that fires the event when the player clicks, but I don't think I need to post it.
Thanks for reading.

2 comments
I've seen this RayCasting Module before, and im not sure how to use it with hitboxes. I would have to put about 20 welds so the Module could compensate for every part the player could get hit in. Also, changing the size of the part inside my script would cause problems, because Im pretty sure the welds would either break or they would have an incorrect hitbox. Then I would have to change the syste
I found a sorta hacky fix for this. I just made the hitbox a falling brick that gets put back into the same position quickly every .1 seconds.