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

Humanoid ontouched help? If then else help

Asked by 7 years ago

Henlo, guys. Trying to make a kill script that doesn't hurt me, why doesn't this work?

function onTouched(hit)
    if not hit or not hit.Parent then return end
    local human = hit.Parent:findFirstChild("Humanoid")
    if human and human:IsA("Humanoid") then
        if human.Parent.Name == "QuantumWaffle" then
            print ("NO!")
            wait(1)
        end
        else
        script.Parent.Transparency = 1
        script.Parent.Part.Transparency = 0
        human.Parent.Head.Anchored = true
        script.Parent.kerchoo:Play()
        script.Parent.Ouch:Play()
        wait(7)
        human:TakeDamage(100)
        script.Parent.Part.Transparency = 1
        script.Parent.Transparency = 0

    end
end

script.Parent.Touched:connect(onTouched)

Please, if you can, post an edited version. Thanks!

1 answer

Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
7 years ago

Your end is in the wrong position. Move the end on line8 to the bottom.

0
With bottom i mean line 19 RubenKan 3615 — 7y
Ad

Answer this question