Let's say a player touches a part and he touched it with it "Right Arm" or "Left Leg", how would I code something that detects that part of his/her body that it touches and gives a certain amount of damage?
Parent an IntValue or NumberValue in the part and subtract a value from it on collision.
--Script game.Players.PlayerAdded:connect(function(ply) ply.CharacterAdded:connect(function(cha) local hum = cha:WaitForChild("Humanoid") local parts = { ["Right Arm"] = 5, --R6 ["Left Arm"] = 5, ["LeftLowerArm"] = 5, --R15 ["LeftUpperArm"] = 5, ["RightLowerArm"] = 5, ["RightUpperArm"] = 5, ["RightHand"] = 2, ["LeftHand"] =2 } for I,v in pairs(cha:GetChildren()) do if parts[v.Name] then local hp = Instance.new("IntValue",v) hp.Name = "Health" hp.Value = parts[v.Name] end end end) end) --Part that Touches character script local damage = 5 script.Parent.Touched:connect(function(hit) local par = hit.Parent if par.ClassName == "Model" then local hp = hit:FindFirstChild("Health") if hp then hp.Value = hp.Value - damage if hp.Value <=0 then hit:Destroy() end end end end)