I’m using this knife free model for my melee system. I’m trying to make it find the target (or the person receiving the knife blade and taking damage) and then turning on the blood particles inside of their UpperTorso. But this code isn’t mine, so I can’t really understand it. What is the actual target? Like it declares an “h” and that’s the humanoid of the target that takes damage, but I don’t know how to change the humanoid into the UpperTorso.
code:
function on(t)
local h = t.Parent:FindFirstChildOfClass("Humanoid")
if h ~= nil and CanDmg == true then
CanDmg = false
local cre = Creator.Value
h:TakeDamage(parent.Dmg.Value)
h.UpperTorso.Blood1.Rate = 100
h.UpperTorso.Blood2.Rate = 100
Handle.Swing:Stop()
local randomnumber = math.random(1, 2) -- random hit sound play
if randomnumber == 2 then
script.Parent.Handle.Hit2:Play()
end
if randomnumber == 1 then
script.Parent.Handle.Hit1:Play()
end
if h.Health>0 then
if not h:FindFirstChild("creator") then
local ov = Instance.new("ObjectValue",h)
ov.Name = "creator"
ov.Value = game.Players:WaitForChild(cre.Name)
else
local ovs = h:GetChildren()
for i = 1,#ovs do
if (ovs[i].Name == "creator") then
ovs[i].Value = game.Players:WaitForChild(cre.Name) end
end
end
end
end
end
Handle.Touched:Connect(on)