Hello.
I am currently making a Damage script, that when you run into a specific NPC's HumanoidRootPart, it prints out the Player's character in workspace. This at times prints out the player, and at other times it prints out a hat they have. It's very unconsistant and I'm extremely confused about it and why it's happening. I've never ran into an issue like this before, and it;s very confusing.
My Script:
local Debounce = false local NPC = script.Parent local HumanoidRootPart = NPC.HumanoidRootPart local Humanoid = NPC.Humanoid local AnimationsFolder = NPC.Animations local AttackAnimation = AnimationsFolder.Attack local Animation = Humanoid.Animator:LoadAnimation(AttackAnimation) HumanoidRootPart.Touched:Connect(function(Hit)) if not (Debounce) then Debounce = true print(Hit.Parent) Animation:Play() wait(1) Debounce = false end end)
If I could get help with this, it would be great. Thanks!
Try add a check that the part that hit is a player's character
if game.Players:GetPlayerFromCharacter(Hit.Parent) and not Debounce then ... end