I know you would do the function onTouch then call it but how do I make the part in workspace detect your humanoid???
The Touched event tells you what part is touching. If that part is someone's leg, we can get the parent (the character model) and from there get the Humanoid.
script.Parent.Touched:connect(function(part) if part.Parent:FindFirstChild("Humanoid") then part.Parent.Humanoid:TakeDamage(30) end)
Or
function AFunctionIMadeToConnectToTheTouchedEvent(ThePartThatTouched) if ThePartThatTouched.Parent:FindFirstChild("Humanoid") then ThePartThatTouched.Parent.Humanoid:TakeDamage(30) end end script.Parent.Touched:connect(AFunctionIMadeToConnectToTheTouchedEvent)
It's pretty simple, You call the touched event, if there's a humanoid take damage
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid ") then hit.Parent.Humanoid:TakeDamage(15) end end)