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

why wont my sword print the parent of the thing its touching or t make humanoids take damage?

Asked by
Jumbuu 110
8 years ago
script.Parent.Blade.Touched:connect(function(hit)
    if equipped and character and humanoid and humanoid.Health >= 0 and hit and not hit:IsDecendantOf(character) then
        target = hit.Parent:FindFirstChild'Humanoid'
        if target and target.Health >= 0 then
            print(hit.Parent.Name)
            target:TakeDamage(damage)

        end
        end
    end)
1
try doing the hit event in another script, because at the current point, you are trying to do to much in 1 script. scottmike0 40 — 8y

1 answer

Log in to vote
1
Answered by
Rawblocky 217 Moderation Voter
8 years ago

Just change all the stuff inside it to this:

script.Parent.Blade.Touched:connect(function(hit)
    if hit.Parent.Humanoid ~= nil then
    hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - (The damage u want)
        end
    end)
Ad

Answer this question