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

This script is not killing me for some reason?

Asked by
duckyo01 120
9 years ago

What the problem is is that when I have my arm it would not kill me but it would not let me go through which is good but still the part that I don't know what I did wrong but if I have a arm it wouldn't kill me.

local part = script.Parent

function onTouch(hit)
    local Player = hit.Parent
    if Player:FindFirstChild('Right Arm') == nil then
        part.CanCollide = false

        part.Transparency = 0.6

        wait(2)

        part.Transparency = 0

    else
        local Guy = script.Parent:FindFirstChild('Humanoid')

        part.CanCollide = true

        part.Transparency = 0

        Guy.Health = 0
    end
end
part.Touched:connect(onTouch)
0
If you have any self-removing parts (ex bullets), you should add "if Player == nil then return end" right after line 4 chess123mate 5873 — 9y

2 answers

Log in to vote
0
Answered by
FiredDusk 1466 Moderation Voter
9 years ago

On line 21 do "Guy.Humanoid.Health = 0"

Ad
Log in to vote
0
Answered by 9 years ago

local Guy = script.Parent:FindFirstChild('Humanoid')

should be

local humanoid = Player:FindFirstChild('Humanoid')
if not humanoid then return end
humanoid.Health = 0

Answer this question