Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to fix when humanoid dies, door opens?

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

✓ Accepted answer

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

2 comments

0

Didn't work. I'm thinking because it's for LocalPlayer and not the NPC Humanoid, How would I do that?

0

workspace.NPC.Humanoid.Died

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

1 comment

0

Thanks bro

This discussion is preserved as it was. New answers, comments, and votes are closed.