Randomly dying when killing a dummy?

Straight to the point, I’m making a attack like Pain’s Universal Pull from Naruto . And when i tested it on a dummy, it works. But when I kill him, I randomly die? The only TakeDamage here is to the dummy’s humanoid, not mine. This also utilises Mouse.Target fired from a localscript. There’s no errors in console, either.

Here is the script, located in ServerScriptStorage:


game.ReplicatedStorage.UniversalPull.OnServerEvent:Connect(function(plr, target)
	if target.Name == "HumanoidRootPart"then
		if target.Parent.Name == plr.Name then return end
		local other = target
		local animator = target.Parent.Humanoid.Animator
		local plranimator = plr.Character.Humanoid.Animator
		local chr = plr.Character
		
		local smash = plranimator:LoadAnimation(script.PullSmash)
		local pullanim = plranimator:LoadAnimation(script.Pulling)
		local pulledanim = animator:LoadAnimation(script.EnemyPulled)
		local pullinganim = animator:LoadAnimation(script.Pulled)
		
		
		
		
		pullanim:Play()
		script.pullsfx:Clone().Parent = chr.HumanoidRootPart
		chr.HumanoidRootPart.pullsfx:Play()
		script.smashsfx:Clone().Parent = other
		chr.Humanoid.AutoRotate = false
		chr.Humanoid.WalkSpeed = 0
		chr.Humanoid.JumpPower = 0
		wait(0.8)
		pullinganim:Play()
		pullanim:AdjustSpeed(0)
		
		local bp = Instance.new("BodyPosition", other)
		bp.Position = chr["Right Arm"].Position
		bp.D = 5 -- Adjust to your liking.
		bp.MaxForce = Vector3.new(10000, 10000, 10000) -- Adjust to your liking 
		bp.P = 70 -- Adjust to your liking

		repeat wait() until (chr["Right Arm"].Position - other.Position).Magnitude < 5
		other.CFrame = chr["Right Arm"].CFrame * CFrame.Angles(math.rad(0), math.rad(160), math.rad(0))
		local weld = Instance.new('WeldConstraint')
		weld.Parent = chr
		weld.Part0 = chr["Right Arm"]
		weld.Part1 = other
		pulledanim:Play()
		pullanim:Stop()
		pullinganim:Stop()
		smash:Play()
		other.BodyPosition:Destroy()
		chr.HumanoidRootPart.pullsfx:Destroy()
		chr.HumanoidRootPart.Anchored = true
		wait(1.45)		
		other.smashsfx:Play()
		target.Parent.Humanoid:TakeDamage(40)
		wait(0.5)
		weld:Destroy()
		other.Anchored = true
		wait(0.5)
		chr.Humanoid.WalkSpeed = 16
		chr.Humanoid.JumpPower = 50
		chr.Humanoid.AutoRotate = true
		chr.HumanoidRootPart.Anchored = false
		wait(0.3)
		smash:Stop()
		wait(1)
		other.Anchored = false
		pulledanim:Stop()
		other.smashsfx:Destroy()
	end
end)

As you can see, I also added an extra check if the target was actually the player’s HumanoidRootPart. But It didn’t work.

1 Like

try destroying the weld before you inflict damage on the dummy

Woah! I never thought the fix would be that easy. I thought welds doesn’t kill you when the other humanoids die haha. Thank you for the help.