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?

1wait(5)
2 
3if Humanoid.Health<1 then
4 
5    script.Parent.Parent.Door.Transparency= 1
6    script.Parent.Parent.Door.CanCollide= false
7    end
8end

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:

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

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

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

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

0
Thanks bro greatneil80 2647 — 4y

Answer this question