Error "attempt to call missing method 'WaitForChild' of table"

  1. What do you want to achieve? Keep it simple and clear!
    I am trying to make combat from a tutorial
  2. What is the issue? Include screenshots / videos if possible!
    Every time I attack with my sword it gives me the error “attempt to call missing method ‘WaitForChild’ of table”
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried looking up the error to no avail and I checked the video but he did it the same way
function module.SetCombat()
	return setmetatable({
		Damage = 5,
		StunDuration = .5,
		Character = nil,
		Animations = game.ReplicatedStorage.CombatFX.PunchAnims:GetChildren(),
		FX = nil,
		Size = Vector3.new(6,6,6),
		StartTime = .16,
		StopTime = .25,
		Offset = CFrame.new(0,0,-2.5),
		MaxCombo = 5,
		
	}, module)
end


function module:Attack()
	local character = self.Character
	local humanoid = character:WaitForChild("Humanoid") <--- ERROR
	local rootpart = humanoid.RootPart
	local animator = humanoid.Animator

	local characterValue = CombatTable[character]

	local combo = characterValue.Combo
	local attacking = characterValue.Attacking
	local stunned = characterValue.Stunned
	local blocking = characterValue.Blocking
	
	if combo > self.MaxCombo then return end

	if attacking or stunned or blocking then return end
	characterValue.Attacking = true
	
	local animations = self.Animations
	local animation = animator:LoadAnimation(animations[combo])

	local hitbox = MuchachoHitbox.CreateHitbox()
	hitbox.Size = self.Size
	hitbox.Offset = self.Offset
	hitbox.CFrame = rootpart
	hitbox.Visualizer = false

	task.delay(self.StopTime, function()
		ComboReset(characterValue, combo, self.MaxCDombo)
		hitbox:Stop()

		if combo == self.MaxCombo then
			task.wait(0.1)
		end

where do you assing the module’s Character? it seems to be nil when you create it so it must’ve changed since then

It is in another script which connects with an event.

remote.OnServerEvent:Connect(function(player)
	local character = player.Character
	local tool = character:FindFirstChildOfClass("Tool")
	
	if tool then return end
	
	local Combat = CombatManager.SetCombat() 
	Combat.Character = player.Character
	Combat.FX = fx
	
	Combat:Attack()
end)