I have a door model,and the doorknob haves Humanoid and the part of it is called "Head" ,the door part is called "Torso",So,the doorknob receives the damage correctly,but the door doesn't open,help!
while true do if script.Parent.Humanoid.Health <= 0 then script.Parent.Torso.CanCollide = false script.Parent.Torso.Transparency = 1 script.Parent.Head.Transparency = 1 script.Parent.Door2.CanCollide = true script.Parent.Door2.Transparency = 0 script.Parent.Handle2.Transparency = 0 end end
As Phlegethon said, this is not working, and you're studio is probarly crashing because your while loop is gonna be running and looping infinitly without a delay between each times it loops. So you gotta add a wait in your loop.
Orrrrr you can make this way better by using the Died
event, so there's no need to put it in a while loop cuz an event doesn't have to be looped, it can be called if something happens at any times, but of course not always.
Always use the died event its useful and better than checking if health is == 0.
script.Parent.Died:Connect(function() script.Parent.Torso.CanCollide = false script.Parent.Torso.Transparency = 1 script.Parent.Head.Transparency = 1 script.Parent.Door2.CanCollide = true script.Parent.Door2.Transparency = 0 script.Parent.Handle2.Transparency = 0 end)
Easy peasy you just find the guy's health on zero and HULK SMASH the door open!
There is a Health property in Humanoid in Character.
if game.Workspace.YourUsernameHere.Humanoid.Health == 0 then door.Parent = nil end
Don't thank me, I don't want it.