Die on Touch
Trap Part
Trap Part
local trapPart = script.Parent
local function onPartTouch(otherPart)
local partParent = otherPart.Parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if ( humanoid ) then
-- Set player's health to 0
humanoid.Health = 0
end
end
trapPart.Touched:Connect(onPartTouch)
Line by Line
Line by Line
local trapPart = script.Parent
This line defines a variable called trapPart and links the script to the part the script is under
This line defines a variable called trapPart and links the script to the part the script is under