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 11 years ago

For my Bleach RPG, characters will morph into a built model upon spawning. Some of these models include having largely sized limbs and Torso's. Since I'm resizing the limbs to morph the character, each Motor in the Torso will temporarily have a Part1 of nil. In order to counter this, I first anchor the limb and then store the value of Part1 as an ObjectValue and then after it's finished resizing it will set the Part1 back to it's correct value.

My problem is, there are many cases in which the player will spawn and instantly die; probably since it cannot reconnect the limbs together quickly enough. It works fine it Play Solo, but the character only lives 2 out of 3 times in server mode.

Extra information: The welds C0 and C1 aren't defined in the morph script; there's a localscript (animation) that will be pasted into the character that sets the C0 and C1 if the Morph-To body is different from the typical Roblox body.

01--userdata char - This is the player's character model.
02--userdata model - This is the model that char will morph into.
03 
04--Clears character appearance
05for _,v in pairs(char:GetChildren()) do --Anchor the character before resetting welds
06    if v:IsA("BasePart") then
07        v.Anchored = true
08    end
09end
10for _,v in pairs(char:GetChildren()) do
11    for _,x in pairs(v:GetChildren()) do
12        if x:IsA("Motor6D") then
13            Instance.new("ObjectValue",x).Value = x.Part1
14            x.Part1 = nil
15            --Stores the Part1 value inside of the player's limb weld
View all 57 lines...

1 answer

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
11 years ago

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.

Ad

Answer this question