Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a way to prevent characters from breaking upon death?

Asked by 8 years ago

I've been wondering for along time and never really found out how to do this.

Im not asking for a script, just for a step in the right direction, thank you.

3 answers

Log in to vote
2
Answered by 8 years ago

A simpler way of wfvj014's solution would be a loop.

My appologies, I incorrectly connected the "Died" event.

game.Players.PlayerAdded:connect(function(plr)
    local A = game.Workspace:WaitForChild(plr.Name):GetChildren()
    game.Workspace:WaitForChild(plr.Name).Humanoid.Died:connect(function()
        for i,v in pairs(A) do
            if v:IsA("BasePart") then
                v.Anchored = true
            end
        end
    end)
end)
0
Use Local Variables. You would have to, you're in a function. Also local variables are almost always better. User#11440 120 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

there was a plugin for it but I don't know if this is it Character-Animations

Log in to vote
0
Answered by 8 years ago

I'll provide a way of doing this.

Just anchor the player's parts on death

To do this, use a Died Event. When A player dies, anchor their parts.

Here's an example,

--in a regular script in ServerScriptService
game.Players.PlayerAdded:Connect(function(plr)
    plr.Died:connect(function()
        plr.Character:FindFirstChild("LeftLeg").Anchored = true
        plr.Character:FindFirstChild("RightLeg").Anchored = true
        plr.Character:FindFirstChild("Torso").Anchored = true
        plr.Character:FindFirstChild("Head").Anchored = true
        plr.Character:FindFirstChild("LeftArm").Anchored = true
        plr.Character:FindFirstChild("RightArm").Anchored = true
    end)
end)

You could go through all of the parts and anchor them but I didn't feel like it.

There may be better solutions, this is just my solution.

Good Luck

0
Nice solution, but there are a few things I would like to point out: plr.Died is not an event. However, plr.Character.Humanoid.Died is an event. Also, the anchoring part is overcomplicated. He could just use a for i,v in pairs loop to get all the baseparts in the character. else than that, nice thought ;) sigve10 94 — 8y

Answer this question