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)