So I've put a part that deals damage to players on touch into the StarterCharacter, and I've welded it on to the player's back( this is where I need it ). I used the normal damage server script with debounce and I put it into the part. The problem is, when I play test the game with the StarterCharacter inside StarterPlayer, the part no longer deals damage. Here's the script.
local debounce = false
local dmg = 51
function OnTouched(hit)
if hit.Parent ~= nil then
if debounce == false and hit.Parent:findFirstChild("Humanoid") ~= nil then
debounce = true
hit.Parent:findFirstChild("Humanoid"):TakeDamage(dmg)
wait(2.15)
debounce = false
end
end
end
script.Parent.Touched:connect(OnTouched)

1 comment
Make sure the part is touching the character, add a print('hit') to see if it is.