So I’m trying to simply, damage a humanoid when they touch the hitbox. Every single other time ive done this it’s worked completely fine, but for some odd reason. Now when I do it, it doesn’t work.

A different script calls the hitbox to the front of the character (including the script) and uses it.

local character = script.Parent.Parent
local hum = character:WaitForChild("Humanoid")
local player = Players:GetPlayerFromCharacter(character)
local hitbox = script.Parent
hitbox.Touched:Once(function(hit)
local hithum = hit.Parent:FindFirstChild("Humanoid")
	if hithum ~= hum then
		hithum:TakeDamage(10)
		print(hithum.Health)
		end
end)

this exact same script was used in a different thing and worked completely fine.
Any ideas on what im doing wrong?,
Also if theres anyway to make it more efficient LMK
(The script is inside of the hitbox. And I use a local script to do all the animation and hitbox summoning stuff)

Well you’re using the :Once() connector, so the event is only fired once when it happens, and then it disconnects the event. So it’s possible the hitbox touched something else before you, and so the event no longer works anymore.

Change the :Once() connector to :Connect() and you should be fine.

2 Likes

The reply above mine is correct, but I also want to ask where the hitbox part is even placed? I’m guessing it’s in the character which, sure if that’s necessary you can do that. But if it’s not in the character then its probably referencing the workspace or something rather than a character.

If the hitbox part is a descendant of workspace, I suggest redoing this code entirely and checking if the parent of hit has a child named “Humanoid” rather than what you’re doing here.