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

How to make sure a character lives while morphing?

Asked by 6 years ago
Edited 6 years ago

Hi

I have a StarterCharacter in StarterPlayer which consists of a Head and a Torso with a motor6d in the Torso to weld the Head and the Torso together.

Link to image to explain the setup

What I want to do is change the size of the Torso without killing the player. It kills the player at the moment because the motor6d disconnect which causes the head to disconnect from the torso which kills any roblox character.

In search for a solution I found this answer on scripting helpers which gives a likely answer which appears like it should work.

https://scriptinghelpers.org/questions/628/how-to-make-sure-a-character-lives-while-morphing

Try creating the new Character without resizing the current one, and then "transplanting" the humanoid into the new Character.

You can weld the new Character without it breaking, and only hopping the Humanoid over should stop it from dying.

However I cannot seem to get my script to work as the answer suggested because the only function I can find which moves instances is "Clone()" (which technically copies instances not moves them as the answer suggests.)

Here is my script so far which is executed when the character spawns and should work as the answer suggested.


game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character:WaitForChild("Torso") character:WaitForChild("Head") --character.Head.CFrame = CFrame.new(1360.244, 5, 83.755) wait(1) character.Archivable = true Hum = character.Humanoid:Clone() --Clone humanoid character.Humanoid:Remove() -- Remove current humanoid NewChar = character:Clone() -- Clone the current character NewChar.Torso.Size = Vector3.new(5,5,5) -- Change the torso size of the new character motor6d = game.Lighting.RootJoint -- Grab the motor6d and set up welds to new parts motor6d.C0 = NewChar.Torso.CFrame motor6d.C1 = NewChar.Head.CFrame Hum.Parent = NewChar -- Paste old humanoid into new character model NewChar.Parent = game.Workspace -- Set the new character model to workspace character1 = character character = NewChar character1:Remove() -- Destroy old character end) end)

This script creates the new character and rigs it however the camera does not follow the new character, and movement keys do nothing.

Has this way of scaling the character model without dying been patched out? Is there a better way of changing the size of a character part now?

Thank you in advance for anyone who replies, and if anything in my question is not clear please comment so I can make it clear.

0
Maybe make a separate torso part (not named 'Torso' or 'UpperTorso') that welds to the character's torso when morphing, and change the new torso so it isn't changing anything from the player's actual torso? im_Draco 3 — 6y

Answer this question