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

I'm having difficulties with a shutoff-animation script. help?

Asked by 5 years ago

Here's the deal. I try to make a four-armed robot that infiltrated a facility, and got locked up in a temporary holding cell there. The main reactor fails and there's a time before the robot dies. a fire breaks out in his cell, and he makes noise by hitting the bars to try to escape. if you open the cell, he walks out, but dies as an explosion knocks him forwards. due to a misunderstanding in the lua code, I get this.

19:56:07.073 - Script 'Workspace.Deathtrap.Escape', Line 7 19:56:07.073 - Stack End 19:56:07.419 - Life is not a valid member of Model

I had the script as the child of the model "Deathtrap", but the error is still there, no matter how many times I re-run the code. Here's the script in question, it is supposed to shut off the script of contained and dying in cell.

local A = script:WaitForChild("VainEscape")
local A2 = script:WaitForChild("Ded")
local B = script.Parent.Humanoid
local C = B:LoadAnimation(A)
local D = B:LoadAnimation(A2)
C:Play()
workspace.Deathtrap.Life.Disabled = true
C:GetMarkerReachedSignal("Impact"):Connect(function()
    script.Parent.UpperTorso.UpperLeftShoulder:Destroy()
        script.Parent.UpperTorso.UpperRightShoulder:Destroy()
    script.Parent.UpperLeftEye.UsePartColor = true
        script.Parent.UpperRightEye.UsePartColor = true
    C:GetMarkerReachedSignal("alreadyded"):Connect(function()
        script.Parent.UpperTorso.LowerLeftShoulder:Destroy()

        script.Parent.Head.LeftEarJoint:Destroy()
        script.Parent.LowerTorso.LeftHip:Destroy()
        script.Parent.LowerTorso.RightHip:Destroy()
        script.Parent.LowerLeftEye:BreakJoints()
        script.Parent.LowerRightEye:BreakJoints()
        script.Parent.UpperLeftEye.UsePartColor = true
        script.Parent.UpperRightEye.UsePartColor = true
    C:Stop()
    D:Play()
    workspace.Deathtrap.Life:Destroy()
    end)

end)

Is there any way to fix that problem in the script above?

Answer this question