NPC Causes BreakJointsOnDeath to be true

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want BreakJointsOnDeath to be equal to false so I can play a death animation when the player dies.

  2. What is the issue? Include screenshots / videos if possible!
    When the health of a player is changed by the server the player’s joints do not break and the animation plays, but when an NPC Zombie kills the player his joints end up breaking and I am not sure why. I will post a video below
    I have tried putting Humanoid.BreakJointsOnDeath = false in the function for health changed, but that still doesn’t work. Does anyone have an idea why the NPC is causing my player’s joints to break?
    This is what happens when a zombie kills the player:
    robloxapp-20200621-2122238.wmv (2.0 MB)

This is what should happen:
robloxapp-20200621-2129168.wmv (661.6 KB)

wait()
local player = game.Players.LocalPlayer
local Humanoid = script.Parent.Humanoid
local sound = script.Parent.HumanoidRootPart:WaitForChild("Died")
local playerGui = player:WaitForChild("PlayerGui")
sound.Volume = 0
Humanoid.BreakJointsOnDeath = false
local DA = Instance.new("Animation")
DA.AnimationId = "rbxassetid://5215659515"
local blackout = playerGui.GameGUI:WaitForChild("Blackout")
local DeathAnimation = Humanoid:LoadAnimation(DA)
local TweenService = game:GetService("TweenService")
local tween = TweenService:Create(blackout, TweenInfo.new(1), {Transparency = 0})
Humanoid.HealthChanged:Connect(function(Health)
    if Health <= 0 then
        print("Died")
		script.Parent.HumanoidRootPart.Anchored = true	
		local tween = TweenService:Create(blackout, TweenInfo.new(2.5), {Transparency = 0})
		tween:Play()
		DeathAnimation:Play()
		wait(0.5)
		script.Sound:Play()
        wait(2.5)
        script.Parent:Destroy()
	end
	
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

How about making it so that whenever a character spawns, their Humanoid’s BreakJointsOnDeath property is set to False?

game.Players.PlayerAdded:Connect(function(plr)			
	plr.CharacterAdded:Connect(function(char)
		char.Humanoid.BreakJointsOnDeath = false
    end)
end)

Your character getting killed by a zombie might have not triggered the script to set its Humanoid’s BreakJointsOnDeath property from the default True to False.

1 Like