Hello devs, I’ve created this simple character (I don’t know modeling yet), to practice and learn about how to make a custom character, as well as the objects used to make it work.
However, I’m having a problem.
When the humanoid’s health of the character reaches 0, it doesn’t “fall apart” like a normal Roblox avatar would; instead, it either remains static in mid-air or doesn’t break apart completely. I tried using a script that loops through all the character’s parts, looking for joints (Motor6D) and destroying them, but it still doesn’t work.
Here is a video of the problem (Sorry for the quality, Idk what happened to the recorder).
Edit: Saw the video. Your character isnt anchored, but when your character dies, the only forces acting on those parts on gravity, meanining they get pulled straight down. If you want to make them ‘fall apart’ you have to apply an outwards force on each part when the player dies.
An example of this would be something like
game.Players.PlayerAdded:Connect(function(player: Player)
player.CharacterAdded:Connect(function(character: Model)
character:WaitForChild("Humanoid").Died:Connect(function()
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
local forceVector = (character:GetPivot().Position - v.Position).Unit * math.random(5,10)
v:ApplyImpulse(forceVector)
end
end
end)
end)
end)
These weldconstraints are for connecting parts that contain decals (one for the face and another for the Roblox logo, referring to a t-shirt). I did this to create the effect from the Mario 64 model where it looks like the texture on his eyes and overalls buttons is slightly separated from the model.
I thought it might be due to the WeldConstraints, but I removed them and the same issue still occurs.
Here’s the ‘perfect’ version of this (I think, – I did test it)
You can paste this into a regular server script parented to your StarterCharacter model and it will do the effect
local forceFactor = 25 -- effective but not overkill
local char = script.Parent
char:WaitForChild("Humanoid").Died:Connect(function()
for i, obj:BasePart in(char:GetChildren()) do
if obj:IsA("BasePart") then
local forceVector = (obj.Position - char:GetPivot().Position).Unit * obj:GetMass() * forceFactor
obj:ApplyImpulse(forceVector)
print('impulsed '..obj.Name)
end
end
end)
This was interesting ‘bug’ given that your characters physics are under client replication until death, meaning once you die you can then apply the ‘Break apart’ effect on the server, but doing so on the client will cause the parts to stutter and return to their original place.