Hi,
I copy-pasted the exact script from Roblox education site but it doesn't work. The script is in the workspace
local trap = script.Parent
-- Checks for Humanoid in otherPart
local function onTouch(otherPart)
-- Store parent of otherPart
local character = otherPart.Parent
-- Looks for a humanoid
local humanoid = character:FindFirstChil("Humanoid")
if humanoid then
-- If part has humanoid, set health to 0
humanoid.Health = 0
end
end
-- Connect the Touched event to onTouch
trap.Touched:Connect(onTouch)

6 comments
did you put the code inside the part?
Roblox studio doesn't allow script inside a part. It's not possible unless you create a script that is Child of the Part and put your script inside "Script"
It is possible . That is what jesse meant when he said to put the code insdie the part.
sorry I misinterpreted you to mean putting code inside part without creating a script. Yes I did put it in the part. I used to code for about a month and then stopped. Now I am back at it, but couldn't make a trap part which I previously learned in the first few day of coding
sorry i meant to say script inside the part.
Change FindFirstChil to FindFirstChild and that will fix your problem