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 7 years ago
Edited 7 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.

01game.Players.PlayerAdded:connect(function(player)
02    player.CharacterAdded:connect(function(character)
03 
04        character:WaitForChild("Torso")
05        character:WaitForChild("Head")
06 
07 
08        --character.Head.CFrame = CFrame.new(1360.244, 5, 83.755)
09        wait(1)
10        character.Archivable = true
11        Hum = character.Humanoid:Clone() --Clone humanoid
12        character.Humanoid:Remove() -- Remove current humanoid
13        NewChar = character:Clone() -- Clone the current character
14        NewChar.Torso.Size = Vector3.new(5,5,5) -- Change the torso size of the new character
15        motor6d = game.Lighting.RootJoint -- Grab the motor6d and set up welds to new parts
View all 28 lines...

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 — 7y

Answer this question