Is there a way make a part which is able to take damage like a NPC? Can anyone send me a link or how to do it?
BaseParts
have a RBXScriptSignal
called Touched
which fires when the part is touched. You can use this to detect when the part is touched and then if the script can find a humanoid in the part's parent, damage that humanoid. Here's an example (this will also damage players).
-- If you are going to use this code, make sure to put it in a SERVER script under the part local Part = script.Parent Part.Touched:Connect(function(hit) if hit.Parent:FindFirstChildOfClass("Humanoid") then -- If the parent of the part touched has a humanoid then hit.Parent:FindFirstChildOfClass("Humanoid"):TakeDamage(10) -- Take 10 damage end end)