Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to code a killbrick system?

Asked by
iivSnooxy 248 Moderation Voter
4 years ago

I am trying to figure out how to code a killbrick system can someone help me?

1local trapPart = script.Parent

1 answer

Log in to vote
0
Answered by
goodlead -62
4 years ago
Edited 4 years ago

Hello snooxy, I am here to help you.Here is the code:

01local trapPart = script.Parent
02trapPart.CanCollide = false
03 
04local 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
10end
11trapPart.Touched:Connect(onPartTouch)
0
You  chcanoose how much damage it will take from humanoid. goodlead -62 — 4y
Ad

Answer this question