I need help making a part that will make you take damage if you touch it. Thanks!
function onTouch(hit) if game.Players:FindFirstChild(hit.Parent.Name) ~= nil then Character.Humanoid:TakeDamage(10) script.Parent:Destroy() end end script.Parent.Touched:Connect(onTouch)
This script doesn't work because "Character" is not defined anywhere. It will work if you define Character as hit.Parent, or if you replace line 4 with hit.Parent.Humanoid:TakeDamage(10)