Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to code a killbrick system?

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


local trapPart = script.Parent

1 answer

✓ Accepted answer

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



local trapPart = script.Parent
trapPart.CanCollide = false 

local function onPartTouch(otherPart) 
    local partParent = otherPart.Parent 
    local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")    if humanoid then
        -- Set player's health to 0 aka killing them
        humanoid.Health = 0
    end
end
trapPart.Touched:Connect(onPartTouch)

1 comment

0

You  chcanoose how much damage it will take from humanoid.

This discussion is preserved as it was. New answers, comments, and votes are closed.