I am trying to figure out how to code a killbrick system can someone help me?
1 | local trapPart = script.Parent |
Hello snooxy, I am here to help you.Here is the code:
01 | local trapPart = script.Parent |
02 | trapPart.CanCollide = false |
03 |
04 | local function onPartTouch(otherPart) |
05 | local partParent = otherPart.Parent |
06 | local humanoid = partParent:FindFirstChildWhichIsA( "Humanoid" ) if humanoid then |
07 | -- Set player's health to 0 aka killing them |
08 | humanoid.Health = 0 |
09 | end |
10 | end |
11 | trapPart.Touched:Connect(onPartTouch) |