Like for example in Fencing how the foil's only deal damage to the people on the black plates. How would you script that into a sword to where it can only do damage on a certain part or brick.
Well, you would want to detect which part you were hitting, so i'd do something like:
local Obj = script.Parent local Targets = { ["TargetNameHere"] = true; } Obj.Touched:connect(function(Hit) if Hit.Parent:findFirstChild("Humanoid") and Targets[Hit.Name] then Hit.Parent.Humanoid:TakeDamage(15) end end)
As you can see, I checked to see if the name of the part hit was in the table of names, and only after that was verified did the damage take effect. In this case the weapon (eg. sword) was the script's parent (Obj).
What I would do, is the name damageable part "hittarget", and in the sword's script, i'd add an "if" condition, which would check whether the part it hit is named "hittarget", and only then would it deal damage.