Viewport frame delay issue with loading a humanoid description on a rig that already exists

https://gyazo.com/ab839ebe4f0957c39d3af6caebda121f
You can see in the video if you go frame by frame that there is a slight delay where the rig does not have the intended appearance (which should be the player’s character) and is simply not loaded. How can I fix this delay? Everything is ran from a local script. Here is some code that might prove relevant.

local HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(playerGui.Parent.UserId)
	local Rig = PopupGui.CanvasGroup.ViewportFrame.WorldModel.Rig
	Rig.Humanoid:ApplyDescription(HumanoidDescription)

	for _, finger in Rig.LeftHandle:GetDescendants() do
		if finger:IsA('BasePart') then
			finger.Color = Rig["Left Arm"].Color
		end
	end
	for _, finger in Rig.RightHandle:GetDescendants() do
		if finger:IsA('BasePart') then
			finger.Color = Rig["Right Arm"].Color
		end
	end
	
	local Humanoid = Rig.Humanoid
	local AnimationId = 'rbxassetid://'..tostring(DomainImages[domainArgument]['Animation'])
	local Animation = Instance.new("Animation")
	Animation.AnimationId = AnimationId
	
	local Animation = Humanoid:LoadAnimation(Animation)
	Animation:Play()

So, idk why but Humanoid:ApplyDescription obviously lags a little when used. I would recommend applying the description just once as soon as the player joins the game instead of every time they use the tool.

I don’t know if that’ll work but it’s worth a shot.

Good luck!

(Btw it looks epic)

Pretty sure it needs to be in workspace to work and ApplyDescription only works on server?

Hello, it is normal that there is a delay when you apply the description because the ApplyDescription() cannot instantly change the rig, i fixed your script logic:

Put this on the top of your script:

local Players = game:GetService('Players')

local localPlayer = Players.LocalPlayer
local humanoidDescription = Players:GetHumanoidDescriptionFromUserId(localPlayer.UserId)
local playerRig = Players:CreateHumanoidModelFromDescription(humanoidDescription, Enum.HumanoidRigType.R6)

local templateRig = PopupGui.CanvasGroup.ViewportFrame.WorldModel.Rig
playerRig:PivotTo(templateRig:GetPivot())
templateRig:Destroy()

Replace this with code you provided:

for _, finger in playerRig.LeftHandle:GetDescendants() do
	if finger:IsA('BasePart') then
		finger.Color = playerRig["Left Arm"].Color
	end
end
for _, finger in playerRig.RightHandle:GetDescendants() do
	if finger:IsA('BasePart') then
		finger.Color = playerRig["Right Arm"].Color
	end
end

local Humanoid = playerRig.Humanoid
local AnimationId = 'rbxassetid://'..tostring(DomainImages[domainArgument]['Animation'])
local Animation = Instance.new("Animation")
Animation.AnimationId = AnimationId

local Animation = Humanoid:LoadAnimation(Animation)
Animation:Play()
1 Like

Here a littly cheeky way to stop that, so basiscally just have some sort of container where you hold all the players models with their rigs that have been applied humanoid descriptions and then just clone that and use it for your viewport frame,

you do this right when the player joins aswell and then when they leave you can just destroy their cloned rig that had the humanoid description applied

@nahte06

1 Like