New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
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
3 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 35 — 3y

1 answer

Log in to vote
1
Answered by
Rawblocky 192
3 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