Similar script not working?

I have two attacking hitbox scripts, but for some reason only one of them works… why is this?

Script 1 (WORKING):
wait(3)
local tool = script.Parent
local damageRE = tool:WaitForChild('DamageRE')
local hitHumanoids = {} 

function attack(hit)
	local humanoid = hit.Parent:FindFirstChild('Humanoid')
	local hp = hit.Parent:FindFirstChild('HP')

	if humanoid and hp then
		if not hitHumanoids[humanoid] then
			hp.Value = hp.Value - 10
			hitHumanoids[humanoid] = true
		end
	end
end

damageRE.OnServerEvent:Connect(function()

	hitHumanoids = {}

	local hitbox = Instance.new('Part', tool)
	hitbox.Size = Vector3.new(4, 4, 4)
	hitbox.Anchored = false
	hitbox.CanCollide = false
	hitbox.Massless = true
	hitbox.Transparency = 0.5

	local weld = Instance.new('Weld', hitbox)
	weld.Part0 = tool.Parent.HumanoidRootPart
	weld.Part1 = hitbox

	local hrp = tool.Parent.HumanoidRootPart
	local direction = hrp.CFrame.LookVector
	hitbox.Position = hrp.Position + direction * 1.5

	game.Debris:AddItem(hitbox, 0.2)

	hitbox.Touched:Connect(attack)
end)

Script 2 (NOT WORKING):

local remote = game.ReplicatedStorage.Remotes.eEarth
local hitHumanoids = {} 

function attack(hit)
	print('hit3')
	local humanoid = hit.Parent:FindFirstChild('Humanoid')
	local hp = hit.Parent:FindFirstChild('HP')

	if humanoid and hp then
		print('hit4')
		if not hitHumanoids[humanoid] then
			hp.Value = hp.Value - 10
			hitHumanoids[humanoid] = true
		end
	end
end



remote.OnServerEvent:Connect(function(player)
	wait(0.5833)
	hitHumanoids[player] = {}

	local character = player.Character
	local gauntlet = character:FindFirstChild('Earth')
	local hitbox = game.ServerStorage.Effects.Earth.Spike:Clone()
	hitbox.Parent = workspace
	local offset = character.HumanoidRootPart.CFrame:vectorToWorldSpace(Vector3.new(0, 1, 1)) * -20
	hitbox.Position = character.HumanoidRootPart.Position + offset
	local hitboxDestination = hitbox.CFrame.Y + 25

	local tweenservice = game:GetService('TweenService')
	local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out)
	local tween = tweenservice:Create(hitbox, tweenInfo, {Position = Vector3.new(hitbox.Position.X, hitbox.Position.Y + 25, hitbox.Position.Z)})
	tween:Play()
	game.Debris:AddItem(hitbox, 3)
	print('hit1')
	hitbox.Touched:Connect(attack)
	print('hit2')
end)

If it helps at all, script 2 will get through the hit1 and hit2 prints AND on very few things like the player model or for some reason a few random parts in the workspace, it prints the hit3, but those dont have the HP value so they cant get to hit4. the first script works fine though

You are using .Touched.

.Touched works for physics part, script 1 hitbox is unanchored

Script 2 is being tweened so im assuming its being anchored.

I recommend other hitbox methods due to this limitation with .Touched in that scenario.