How to Make a Death Block in ROBLOX Studio (With Script)

1. Open ROBLOX Develop.
2. Click "Create New Place."


3.
Choose your game template...I chose the normal baseplate.
4. Insert a part into your game and adjust the size if you would like.


5. Right-click on your part and hover your cursor over "Insert Object," then click "Script."
6. Delete the "print ('Hello world!')" part and replace it with the code down below...

function onTouch(part)

local humanoid = part.Parent:FindFirstChild("Humanoid")

if (humanoid ~= nil) then -- if a humanoid exists, then

humanoid.Health = 0 -- damage the humanoid

end

end

script.Parent.Touched:connect(onTouch)

Comments