Humanoid isn't taking damage

  1. What do you want to achieve? Keep it simple and clear!
    I want to make the humanoid to take damage.

  2. What is the issue? Include screenshots / videos if possible!
    The issue is that my script isn’t working.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I couldn’t find any solutions for that.

local WeaponConfig = require(ASCS.ToolConfig:FindFirstChild(tool.Name))

print("Character, humanoid, tool and player is set in the variable.")

local Model = ASCS.Models:FindFirstChild(tool.Name).Handle:Clone()
Model.Parent = tool

-- Hitbox
local newHitbox = RaycastHitboxV4.new(tool:WaitForChild("Handle"))
newHitbox.RaycastParams = RaycastParams.new()
newHitbox.RaycastParams.FilterDescendantsInstances = {character}
newHitbox.RaycastParams.FilterType = Enum.RaycastFilterType.Blacklist

newHitbox.OnHit:Connect(function(hit, humanoid)
	print(hit)
	humanoid:TakeDamage(WeaponConfig.NormalDamage) 
end)
1 Like

You have to call newHitbox:HitStart() for it to actually start raycasting.

2 Likes

I am doing it through a remote event and it was working very well with just a number. But when I added WeaponConfig.NormalDamage, it stopped working.

1 Like

Also, there is newHitbox:HitStart() in the script so that’s not the problem.

1 Like

What is WeaponConfig.NormalDamage? Could you send tht file’s code?

1 Like

Sure.

local Settings = {
	-- << Combo >> --
	MaxCombo = 5; -- The max amount of combos you can do. Make sure to add the same amount of animations!!!
	
	-- << Animations >> --
	-- Template -> Combo[Number] = "rbxassetid://[ID]"
	Combo1 = "rbxassetid://";
	Combo2 = "rbxassetid://";
	Combo3 = "rbxassetid://";
	Combo4 = "rbxassetid://";
	Combo5 = "rbxassetid://"; 
	
	-- << Damage >> --
	LastComboDamage = 20; -- The damage that the weapon will do to the Player / NPC on the last combo.
	NormalDamage = 10; -- The normal damage of the weapon.
	
	-- << NPC / Player >> -- 
	CanHitNpc = true; -- Set to false/true so you can/can't hit npcs.
	CanHitPlayer = true; -- Set to false/true so you can/can't hit players.
	
	-- << Armor >> --
	CanBreakArmor = true; -- Set to true if you can break armor.
}

image
image

1 Like

Try printing WeaponConfig just to confirm that your recieving the correct table, also do you have a while loop, which does HitStart and HitStop with a delay?

1 Like

No, I do not have.
Actually, I got 2 errors.
image

You didn’t return the Settings tbl in your modulescript. Add a return statement at the end.

2 Likes

Thanks so much! I didn’t realize that. It worked.