Cant Damage Humanoids

I want the humanoids to take 10 damage every time I hit them.

The humanoids for some reason take no damage despite the script detecting that they should take damage and there not being any errors.

I have tried a variety of different ways to damage humanoids including humanoid.Health -= 10 and humanoid:TakeDamage(10) but none seem to work. I have also tried this on different npc models and even on players but that makes no difference.

local RunService = game:GetService("RunService")

local tool = script.Parent
local handle = tool.Handle
local remotes = tool:WaitForChild("Remotes")
local config = tool:WaitForChild("Config")

local damage = config:GetAttribute("Damage")

local hitdebounce = {}

remotes.ToolActivated.OnServerEvent:Connect(function(player)
	local char = player.Character
	local touch

	touch = handle.Hitbox.Touched:Connect(function(hit)
		if table.find(char:GetDescendants(), hit) == nil and table.find(hitdebounce, char) == nil and char:FindFirstChild("Humanoid") then
			print(damage)
			print(hit.Parent.Humanoid.Health)
			table.insert(hitdebounce, char)
			char.Humanoid:TakeDamage(damage)
			print(hit.Parent.Humanoid.Health)
		end
	end)

	wait(.5)
	touch:Disconnect()
	table.clear(hitdebounce)
end)

Is this script on the client or a server script? If it’s on the client, have a remote event fire the event and take damage on the server.

This is on the server, and the event is fired from client.

Are the print statements reached?

I dont really know what reach mean, but the print statements do print.

What is the value of damage? What does it print for damage?

The value for damage is 10 as shown in the output in the video.

Have you tried taking damage on the client side in a local script? Based on the documentation I’ve seen, it works if it’s on the client from the example code.

I can try but I dont understand why it wont simply work on the server.

It doesnt seem to work on client either

Could the problem be where I have the server script?
image

It doesn’t matter location but try having it in the ServerScriptService to see if it changes anything.

I could try but I would have to rework the entire script.

I don’t think that would work, just like you said, It doesn’t matter location.

Anyways, how do you detect any humanoids in the local script?

You should be doing game.Players.LocalPlayer.Character.Humanoid:TakeDamage(damage)

So I cant damage humanoids from the server?

You can damage them from the server.

Wait wait, are you trying to take damage in that Touched function?

Yes, but I get the character from the hit then damage the humanoid.