Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a part that's inside of the StarterCharacter deal damage?

Asked by
Lyphios 77
4 years ago

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)
0
Make sure the part is touching the character, add a print('hit') to see if it is. AntoninFearless 622 — 4y

Answer this question