My wall Isn't working. Please,fix my error and say right code.
if script.Parent.Humanoid.Health = 0 then
script.Parent.Head.CanCollide = false
script.Parent.Torso.CanCollide = false
script.Parent.HumanoidRootPart.CanCollide = false
end
My wall Isn't working. Please,fix my error and say right code.
if script.Parent.Humanoid.Health = 0 then
script.Parent.Head.CanCollide = false
script.Parent.Torso.CanCollide = false
script.Parent.HumanoidRootPart.CanCollide = false
end
Your script will only run once. It is best to use Died function of the humanoid to run the code when the player dies.
script.Parent.Humanoid.Died:Connect(function()
if script.Parent.Humanoid.Health == 0 then
script.Parent.Head.CanCollide = false
script.Parent.Torso.CanCollide = false
script.Parent.HumanoidRootPart.CanCollide = false
end
end)
That's dumb .Line 2 is useless If the humanoid dies, obviously the humanoids health is 0.
...unless the health is instantly regenerated before "if script.parent.Humanoid.Health = 0" is called.
Parts that are inside a character model that contains a Humanoid can't be set to cancollide false. When the character dies, remove the humanoid then set the parts cancollide. (removing the humanoid will remove any shirt and pants instances inside the character)
script.Parent.Humanoid.Died:connect(function()
script.Parent.Humanoid:Destroy()
script.Parent.Head.CanCollide = false
script.Parent.Torso.CanCollide = false
script.Parent.HumanoidRootPart.CanCollide = false
end)
Another way you can do this without having to remove the humanoid is to create a collision group and set the character's parts in the group when it dies.
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Why don't you just false the wall cancollide lol, why are you checking if the health is at 0?
You should be checking if the health is full. Not 0...
InfernoExeuctioner - I pretty know you,but I'm using that On NPC,Not player.