Im making a game where i would like to have the body or avatar remain where they died, it already has a ragdoll script but ive been struggling for a long time to find a solution for this,
Anyone who could share a ready script or link to any video or a tutorial somewhere?
the player who dies will be kicked immideately , but their body should remain maybe dublicate and remain there. ive had problems dublicating as in making their body remain
When the character spawns, set the humanoid’s property BreakJointsOnDeath to false. This will break the character from breaking apart on death, allowing you to have a custom ragdoll system. Or, if you just enable the AvatarJointUpdate in StarterPlayer, a ragdoll is automatically applied instead of breaking joints.
Check if the player dies and then just clone the dead character ( make sure “archivable” property is set to true) and then place the clone in the workspace.
When you die and respawn, a new character is created. That also means a new Humanoid with default properties. You need to change the Humanoid.BreakJointsOnDeath property every time they respawn. You can detect this with the player.CharacterAdded event.
thats what im asking to get help with i havent seen a tutorial anywhere either and as i said im a little confused where i check the “archivable” where is it?
apologies for late post. this is a serversided script and this is how i did it
Humanoid.Died:Connect(function()
local corpse = Instance.new("Model")
corpse.Parent = workspace.Terrain -- don't consider doing this it's just a placeholder
corpse.Name = player.Name.."'s Corpse"
for _, limb in character:GetChildren() do
if limb:IsA("LuaSourceContainer") then continue end -- if the thing is a script, skip it
limb.Parent = corpse
end
end)
not the best approach, q_Emilio’s approach may be better for performance.
After your script detects that a player has died, I recommend waiting for the ragdoll to settle, after that you can then kick the player. This is assuming that your ragdoll system does not clone the character to create a separate ragdoll model.
I highly recommend to modify your ragdoll system to clone the character so even if the player is gone, their duplicate/clone still remains as it is not tied to the PlayerRemoving.
Optional: Make sure their corpse is not moving by checking the AssemblyLinearVelocity property on the HumanoidRootPart, after that we will anchor every part on the character. This is not necessary but this is just some optimizations for your game so the ragdoll’s constraints does not need to keep calculating anymore. This also allows you to have more corpse in the game.