Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How come my character dies when given a new torso?

So last time I asked how to morph a character and I did find an answer. It worked, however I wanted to try and use welding. I managed to remove the character's right and left leg and replaced it with my custom morph's legs. I moved on to the torso and when I made it uncollidable and transparent and replaced it with my custom morph's torso, it killed my player when I tested it. I then tried to remove the torso and quickly replace it but that did not work either. I disabled the script and looked into my player's torso, thinking that the Motor6D were the problem and I was right. So now I'm thinking about how to successfully remove the torso or make it invisible and replace it with my own. Here's the script.

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(char)
		wait()
		--Works here
		local newleftknee = game.ServerStorage.CustomModel.LeftKnee:Clone()
		newleftknee.Parent = char
		local weld = Instance.new("Weld", newleftknee)
		weld.Part0 = newleftknee
		weld.Part1 = char.Torso
		weld.C0 = CFrame.new(0.5, 1.5, 0)
		char["Left Leg"]:Destroy()
		newleftknee.Anchored = false
		
		local newleftleg = game.ServerStorage.CustomModel.LeftLeg:Clone()
		newleftleg.Parent = char
		local weld1 = Instance.new("Weld", newleftleg)
		weld1.Part0 = newleftleg
		weld1.Part1 = char.Torso
		weld1.C0 = CFrame.new(0.5, 3, 0)
		newleftleg.Anchored = false
		
		local newrightknee = game.ServerStorage.CustomModel.RightKnee:Clone()
		newrightknee.Parent = char
		local weld2 = Instance.new("Weld", newrightknee)
		weld2.Part0 = newrightknee
		weld2.Part1 = char.Torso
		weld2.C0 = CFrame.new(-0.5, 1.5, 0)
		char["Right Leg"]:Destroy()
		newrightknee.Anchored = false
		
		local newrightleg = game.ServerStorage.CustomModel.RightLeg:Clone()
		newrightleg.Parent = char
		local weld3 = Instance.new("Weld", newrightleg)
		weld3.Part0 = newrightleg
		weld3.Part1 = char.Torso
		weld3.C0 = CFrame.new(-0.5, 3, 0)
		newrightleg.Anchored = false
		
		--Problem starts here
		local newtorso = game.ServerStorage.CustomModel.Torso:Clone()
		newtorso.Parent = char
		newtorso.CanCollide = false
		local weld4 = Instance.new("Weld", newtorso)
		weld4.Part0 = newtorso
		weld4.Part1 = char.Head
		weld4.C0 = CFrame.new(0, 1, 0)
		char.Torso:Destroy()
	end)
end)

4 comments

1

I don't actually think its possible to remove the torso from the character but you can make it invisible and such and weld your custom Torso to it.

1

Ah, thank you! That solved my problem... However, I still don't know why my previous attempt was futile... I made it uncollidable and invisible yet it killed me... Oh well. Thank you!

0

Np

0

It's because you named it torso, and it thinks that you made a new torso that overrides it.

1 answer

✓ Accepted answer

#I've run into this problem before, I know what I'm doing.

So, I know this is an old question, but I'm on my way to answer all unanswered questions on this lonesome summer night.

The problem is, you can't have 2 Torso. Think about it, it's insane How would the script tell the difference from one another? It has to choose one. And? It chooses the wrong one. When the second one you added, named torso Entered the model, the Humanoid immediately defines that as the new Torso. And when the Torso or Head is moved and the other limbs aren't, let's say that character's going to have a bad time.

#Great, now we have the problem, now the solution?

Well, we all know how the humanoid defines the Torso. It's name is Torso, right? Yeah, that's it. The solution is easy. Just don't name is Torso. Feel free to make it clone the name Torso, but change it's name after.

 local newtorso = game.ServerStorage.CustomModel.Torso:Clone()
        newtorso.Name = "newtorso"
        newtorso.Parent = char
        newtorso.CanCollide = false
        local weld4 = Instance.new("Weld", newtorso)
        weld4.Part0 = newtorso
        weld4.Part1 = char.Head
        weld4.C0 = CFrame.new(0, 1, 0)
        char.Torso.Transparency = 1

There's also another problem, I just wanted to point that one out though. There is no way to replace a limb of a character with a different one. You may think it just needs to contain a limb name (Right Arm, Torso, Head) but the truth is, not really. You see, it is the humanoid that defines what's what. So making a new torso for the character just won't work, because even if you add another torso in the model named torso, the humanoid will still define the old one as the torso. And when that torso is removed, instead of finding another torso, the humanoid will die.

how sad.

This discussion is preserved as it was. New answers, comments, and votes are closed.