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

Why doesn't this BoolValue change?

Asked by 8 years ago

I have one script that when a humanoid dies it removes the humanoid and sets a BoolValue to true

function onHealthChanged()

    script.Parent.CurHealth.Text = script.Parent.Parent.Parent.Humanoid.Health
    if script.Parent.Parent.Parent.Humanoid.Health == 0 then
        script.Parent.Parent.Parent.Parent.Dead = true
        script.Parent.Parent.Parent.Humanoid:remove()


    end
end

script.Parent.Parent.Parent.Humanoid.HealthChanged:connect(onHealthChanged)


and another script that when the BoolValue is true it removes a part

if script.Parent.Dead.Value == true then
    script.Parent.Wall:Destroy()


    end

but it doesnt remove the part and in the output it says Dead (The BoolValue) is not a valid member of model

1 answer

Log in to vote
0
Answered by 8 years ago

is the value "Dead" inside whatever the parent of this script is? If not, there's your problem, it could be searching for the value "Dead" when maybe its another layer down or up than a child of the script's parent.

Ad

Answer this question