the title was probably confusing to read which i dont doubt, but heres my issue.
im making a combat system for my game and i want the script to return the message “Blocked” if it finds an accessory in the target character called “Blocking”
i’ve tested this with my friends and with dummies, and the script doesnt seem to detect the Blocked accessory being there, even though it is there. here’s the code which is supposed to do this:
Requests.DamageHumanoid.Event:Connect(function(character, target, properties)
if character:FindFirstChildWhichIsA("ForceField") or target:FindFirstChildWhichIsA("ForceField") then return end
if target:FindFirstChild("Knocked") then return end
print(character.Name .. " has just fired damage humanoid on ".. target.Name ..".")
if properties.block then
if (target.HumanoidRootPart.Position - character.HumanoidRootPart.Position).Unit:Dot(target.HumanoidRootPart.CFrame.LookVector) >= 0.2 then
for _,v in pairs(target:GetChildren()) do
if v.Name == "Blocking" then
v:Destroy()
end
end
end
if target:FindFirstChild("Blocking") then
target.HumanoidRootPart["punch-block".. math.clamp(properties.combo, 1, 4) or 1]:Play()
return "blocked"
end
end
the part in specific in this function that is causing an issue is the “if” statement at the bottom.
i would really appreciate some help as i dont really know what to do… everything else in the system works just fine though