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

"Character Storage" - Post Animation Update?

Asked by
Yvori 25
9 years ago

Note: Character Storage, referring to the process of parenting one's character to Lighting, ServerStorage, or any other such place, pretty much anywhere that isn't Workspace, has many applications. Unfortunately, since the character animation update, trying to use it has become increasingly difficult.

My Problems (~ = easily fixable, - = unknown solution):

--[[
~When parenting character to ServerStorage, the HumanoidRootPart (which the camera is attached to) and the Neck join of the Torso are lost. Can be fixed by copying them back in after.
-Copying the two objects beforehand and placing them back into the character before parenting back to Workspace, then re-setting their Part0s and Part1s respectively kind of works, but kind of doesn't. (See next point)
-If this is done, the character will, for some odd reason, randomly start half-falling into the ground then auto-jumping back out every two or so seconds. Reason unknown.
~For some reason, if the process is repeated, the HumanoidRootPart fails to disappear, breaking any script that re-adds it again though this is easy enough to fix by making it check for one first.
~Animations stop working, though this is fixable by disabling and re-enabling the animation script.
-The RootJoint of the HumanoidRootPart will also randomly disappear, though this may have to do with the multiple HumanoidRootParts caused by the above point.
--]]

The Script (Edited to lose about a hundred lines of unrelated code and made into a click function for easy testing):

function onClick(player)
    character = player.Character
    local neck = character.Torso.Neck:clone()
    local rootpart = character.HumanoidRootPart:clone()
    if character:findFirstChild("Animate") then character.Animate.Disabled = true end
    character.Parent = game.ServerStorage
    local dist = Vector3.new(20,20,20)
    character.Torso.CFrame = character.Torso.CFrame + Vector3.new(dist.x,dist.y,dist.z)
    neck.Parent = character.Torso
    neck.Part0 = character.Torso
    neck.Part1 = character.Head
    rootpart.CFrame = character.Torso.CFrame
    rootpart.Parent = character
    rootpart.RootJoint.Part0 = rootpart
    rootpart.RootJoint.Part1 = character.Torso
    character.Parent = workspace
    if character:findFirstChild("Animate") then character.Animate.Disabled = false end
end

script.Parent.ClickDetector.MouseClick:connect(onClick)

On another note, I'm wondering if this "fake" HumanoidRootPart will work just like the standard HumanoidRootPart for whatever the heck it's supposed to be used for. So far the only differences I can see are that it isn't removed by subsequent character parent changes and that it (might) cause the whole "bouncy character" effect I described.

Answer this question