I'm not fully understanding how a player specifically dies, even after doing lots of research.
When a character dies, the humanoid has a function run called BreakJoints()
An example of this is:
script.Parent.Touched:Connect(function(hit -- Block that hits it, in this case, a body part) -- Assuming if this Script was in a brick if hit.Parent.Humanoid then -- Checking if it's a character instead of a regular brick hit.Parent.Humanoid:TakeDamage(100) -- Kills the character, at this point is when the players humanoid runs the function BreakJoints() end end)
When BreakJoints() is run, the Welds and Motor6Ds are destroyed. This causes the player to break apart into bricks.
To kill a player, you can either set the humanoid's Health to 0 or run the humanoid:TakeDamage() with the MaxHealth of the humanoid in the brackets.
EX:
humanoid:TakeDamage(100) -- If the MaxHealth of the humanoid is 100 this will kill it -- or humanoid.Health = 0 -- This will kill the humanoid in any case
Another rare way to do this, but not the suggested way, is to manually break the joints of the player using the humanoid:BreakJoints() function.
EX:
script.Parent.Touched:Connect(function(hit -- Block that hits it, in this case, a body part) -- Assuming if this Script was in a brick if hit.Parent.Humanoid then -- Checking if it's a character instead of a regular brick hit.Parent.Humanoid:BreakJoints() -- Kills the character by breaking the joints, causing it to not function at ALL. Doing this automatically makes the humanoid health go to 0, or kill the player end end)
(the humanoid is what makes the player able to interact and move around its surroundings, or live. To see the roblox developer page for the humanoid click here )