I made a script that changes the appearance of a character using humanoid:ApplyDescription(). However, when the script is enabled and the character is animated, the character changes its position (see the second video). I have tried changing the position and orientation of the LowerTorso and HumanoidRootPart, but that did not work. Here is video of the problem I am having:
this is what happens when the script is disabled.
this is what happens when the script is enabled.
The part is used to mark the position I want the character to go to when its appearance has been changed. Note that the HumanoidRootPart is anchored. Any help is appreciated!
I there is nothing in the output, no other scripts are messing with the character, and I tried it in another studio and I don’t believe that it is a bug. Things that I have tried so far are changing the position of the HumanoidRootPart and LowerTorso, and removing some things from the script. I believe that the problem is coming from humanoid:ApplyDescription(), because when I removed it from the script, the issue went away. The problem is, how can I change the appearance of the character and keep the same position as shown in the first video when animated?
I can’t think of a reason why :ApplyDescription() would change the position of your character
Although a workaround for this would be to log the CFrame of the humanoidrootpart before you apply it and then after its applied set the humanoidrootpart to the logged CFrame
Edit:
Then the animation itself is likely to be changing the position
Not :ApplyDescription()
Could it be that one of the animation parts has been colliding into the ground which is causing the entire model to move up? Because it seems like this part(which is cancollide off) is refusing to collide through the baseplate. In the animation, I hid this part underneath the baseplate.
There are multiple ways of changing the appearance, all of which are used for different circumstances. If all characters are going to be the same you can use the default character, or if you only want to change clothes (pants, shirt, tshirt) you can do that separately. What is your use case in this game?
local humanoidRootPart = model.HumanoidRootPart
local humanoid = script.Parent.Humanoid
local Table = {}
function GetJoints(targetModel)
local Joints = {
Neck = targetModel.Head.Neck;
Waist = targetModel.UpperTorso.Waist;
RightShoulder = targetModel.RightUpperArm.RightShoulder;
LeftShoulder = targetModel.LeftUpperArm.LeftShoulder;
RightElbow = targetModel .RightLowerArm.RightElbow;
LeftElbow = targetModel.LeftLowerArm.LeftElbow;
RightHip = targetModel.RightUpperLeg.RightHip;
LeftHip = targetModel.LeftUpperLeg.LeftHip;
RightKnee = targetModel.RightLowerLeg.RightKnee;
LeftKnee = targetModel.LeftLowerLeg.LeftKnee;
RightAnkle = targetModel.RightFoot.RightAnkle;
LeftAnkle = targetModel.LeftFoot.LeftAnkle;
RightWrist = targetModel.RightHand.RightWrist;
LeftWrist = targetModel.LeftHand.LeftWrist;
LowerTorso = targetModel.HumanoidRootPart.LowerTorso;
BodyAttach = targetModel.UpperTorso.BodyAttach;
DSM = targetModel.RightHand.DSM
}
return Joints
end
-- Assuming this is a Script and not a LocalScript
game.Players.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()
for _, item in pairs(character:GetChildren()) do -- Loops through all the children of the character.
if item:IsA("Shirt") or item:IsA("Pants") or item.Name == "Clothing" then
item:Destroy()
end
end
end)
local Joints = GetJoints(model)
for index, joint in ipairs(Joints) do
table.insert(Table, #Table + 1, {joint.C0, joint.C1})
end
local playerId = 113170969
humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(playerId))
local M6D = Instance.new("Motor6D")
M6D.Name = "BodyAttach"
M6D.Part0 = model.UpperTorso
M6D.Part1 = model.BodyAttach
M6D.Parent = model.UpperTorso
local M6D2 = Instance.new("Motor6D")
M6D2.Name = "DSM"
M6D2.Part0 = model.RightHand
M6D2.Part1 = model.DSM
M6D2.Parent = model.RightHand
-- Set new joints.
for index, joint in ipairs(Joints) do
joint.C0 = Table[index][1]
joint.C1 = Table[index][2]
end
I’m not sure if it works, if it doesn’t that’s okay.
It might be that animation piece as you said. Have you tried disabling animations?
Something else you could try is putting the humanoid in the sky. As you said there’s a prop piece below that will help you determine if that is the issue.
Thank you! Unfortunately, I tested your script and it doesn’t work. Disabling the animation does nothing because the animation is the one that moves the character back to the block. It’s just that when the character changes appearance, its position becomes offset as shown in the second video.
I tried moving the LowerTorso using CFrame to the Part, but for some reason, the character’s position is different on the client than on the server: