local DamagePart = script.Parent
local Humanoid = Player.Humanoid
local function DamagePlayer()
DamagePart.Touched = Player.Humanoid:TakeDamage(10)
end
while true do
wait(0.65)
DamagePlayer()
end
i'm trying to make a part that when touched damages the player on a loop it doesn't work though i want to put the script in the npc so it can damage the player or any npc that has the same humanoid name as the player it says unable to index nil with humanoid how to fix?

7 comments
Thx
but i want it to damage the player only if it hits the root part of the player
just so it doesn't do too much damage which is not intended
this script will get the player's humanoid, so you don't need to get the player's root part.
hello?
it's that i want it to damage the player if it touches 1 part and it'll have to wait a certain period of time before damaging them once again
i edited the script. I made a cooldown using a debounce, it should work now.