So the monster NPC I am using stores the currently targeted humanoid in a objectvalue called "CurrentTargetHumanoid"
This value is set via this section of code:
if closestCharacter ~= nil then Mind.CurrentTargetHumanoid.Value = closestCharacter.Humanoid end end
It attacks with the following lines:
function Monster:Attack() local myPos, targetPos = Monster:GetCFrame().p, Monster:GetTargetCFrame().p if (myPos - targetPos).magnitude <= Settings.AttackRange.Value then Mind.CurrentTargetHumanoid.Value:TakeDamage(Settings.AttackDamage.Value) Data.LastAttack = tick() Data.AttackTrack:Play() end end
I've been trying to figure out how to edit this in the following way, I want the character it attacks to be set to completely transparent and have new particle effects added to all body parts, I can do most of that myself I just dont know how to find the character it is attacking from how it has its humanoid stored.
I think you'd do this..
function Monster:Attack() local myPos, targetPos = Monster:GetCFrame().p, Monster:GetTargetCFrame().p if (myPos - targetPos).magnitude <= Settings.AttackRange.Value then while (myPos - targetPos).magnitude <= Settings.AttackRange.Value do Mind.CurrentTargetHumanoid.Value:TakeDamage(Settings.AttackDamage.Value) Data.LastAttack = tick() Data.AttackTrack:Play() end end end