Part = script.Parent Part.Touched:Connect(function(hit) if hit.Parent == hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Health = 0 end Part.CFrame = CFrame.new(0, 0, 15) end)
✓ ANSWER ACCEPTED
Why won't the Part reduce my health to 0 when I touch it?
2 answers
✓ Accepted answer
local Part = script.Parent
Part.Touched:Connect(function(hit)
local human = hit.Parent:FindFirstChildOfClass("Humanoid")
if human then
human.Health = 0
Part.CFrame = CFrame.new(0, 0, 15)
end
end)
try this... local Part = script.Parent
local function onPartTouch(otherPart) local partParent = otherPart.Parent local humanoid = partParent:FindFirstChildWhichIsA("Humanoid") if humanoid then humanoid.Health = 0 end end Part.Touched:Connect(onPartTouch)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thanks