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

How to fix when humanoid dies, door opens?

Asked by 4 years ago

This is my script, but I believe something is misplaced. Thoughts?

wait(5)

if Humanoid.Health<1 then

    script.Parent.Parent.Door.Transparency= 1
    script.Parent.Parent.Door.CanCollide= false
    end
end

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Problem: Humanoid isn't defined. No events detected. Waiting is unnecessary.

Localscript in startergui:

repeat wait() until game.Players.LocalPlayer.Character
game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
    workspace.Door.Transparency = 1
    workspace.Door.CanCollide = false
end)

Try it, tell me if it doesn't work, if it does work, please click the answer button, Thanks

0
Didn't work. I'm thinking because it's for LocalPlayer and not the NPC Humanoid, How would I do that? iiiGamerBoy 12 — 4y
0
workspace.NPC.Humanoid.Died greatneil80 2647 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

I figured out the solution

repeat wait() until game.workspace.Test -- Find Location
game.workspace.Test.Humanoid.Died:Connect(function() -- Location and Purpose
    workspace.Door.Transparency = 1 -- Door Invisible
    workspace.Door.CanCollide = false -- Door Walk Threw
end)

I'll accept your answer still for the help @greatneil80

0
Thanks bro greatneil80 2647 — 4y

Answer this question