Updating the animation on ViewportFrame on a Cloned Character help

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I just want to update the animation on ViewportFrame smoothly;

  2. What is the issue? Include screenshots / videos if possible!
    The issue is simple, the Original Character will play an animation, and thus the Cloned Character plays that similar Animation; this also work when you update it in a second time, but when you update the animation the third time; the Cloned Character will play the animation that was updated in a second time, no Third time.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I searched Render in worldmodel and there’s pretty much nothing there.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local ViewportFrame = script.Parent
local RunService = game:GetService("RunService")

local CurrentCamera = workspace.CurrentCamera
local obj = workspace:FindFirstChild(script.Value.Value.Name)
obj.Archivable = true
local currentid = ""

ViewportFrame.CurrentCamera = CurrentCamera

function AuraRead(part)
	local clone = part:Clone()
	local primarypart = part.PrimaryPart
	clone.Parent = ViewportFrame.WorldModel
	if clone.ClassName == "Model" then
		clone:SetPrimaryPartCFrame(CFrame.new(0,0,0))
		clone.PrimaryPart.Orientation = Vector3.new(0, 0, 0)
		clone:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0,0,-((clone.PrimaryPart.Size.X * 2) + (clone.PrimaryPart.Size.Z * 2)) + clone.PrimaryPart.Size.Y * 2)))
		if clone:FindFirstChild("Humanoid") ~= nil then
			clone:FindFirstChildWhichIsA("BodyColors"):Destroy()
			clone:FindFirstChildWhichIsA("Pants"):Destroy()
			clone:FindFirstChildWhichIsA("Shirt"):Destroy()
		end
		if clone:FindFirstChild("Gate") ~= nil then
			clone.Gate:Destroy()
		end
		for i,v in pairs(clone:GetChildren()) do
			if v.ClassName == "Part" and v.Name ~= "HumanoidRootPart" then
				v.BrickColor = BrickColor.new("Really red")
				v.Transparency = 0.8	
				local find = part:FindFirstChild(v.Name)
				if clone:FindFirstChild("Humanoid") ~= nil then	
					local hat = v.Parent:FindFirstChildWhichIsA("Hat")
					hat.Handle.Transparency = 0.8
					hat.Handle.BrickColor = BrickColor.new("Really red")
					hat.Handle.Mesh.TextureId = ""
					--[[
					local weld = Instance.new("Weld")
					weld.Part0 = part:FindFirstChild(v.Name)
					weld.Part1 = v
					weld.Parent = part:FindFirstChild(v.Name)
					--]]
				end
			end
			if v:FindFirstChild("Mesh") ~= nil then
				v.Mesh.TextureId = ""
				if v:FindFirstChild("Decal") ~= nil then
					v.Decal:Destroy()
				end
			end
			if v.ClassName == "MeshPart" then
				v.TextureID = ""
				v.BrickColor = BrickColor.new("Really red")
				v.Transparency = 0.8
			end
		end
	end
	RunService.Stepped:Connect(function()
		local currentCFrame = part:GetPrimaryPartCFrame()
		clone:SetPrimaryPartCFrame(primarypart.CFrame)
		for i, tracks in pairs(part.Humanoid:GetPlayingAnimationTracks()) do	
			local meta = {
				__newindex = function(t,k,v)
					play = clone.Humanoid:LoadAnimation(k.Animation)
					if play.IsPlaying == false then
						play:Play()
					end
					--[[
					if clone:FindFirstChild("Animation") == nil then
						newanim = Instance.new("Animation")
						newanim.AnimationId = k.Animation.AnimationId
						newanim.Parent = clone
						currentid = k.Animation.AnimationId	
						k:Destroy()
						play = clone.Humanoid:LoadAnimation(newanim)
					else
						--print(currentid)
						wait(0.02)
						if currentid ~= k.Animation.AnimationId then
							k:Destroy()
							newanim:Destroy()
						else
							if play.IsPlaying == false then
								play:Play()
							end
						end
					end
					--]]
				end,
			}
			setmetatable(part.Humanoid:GetPlayingAnimationTracks(),meta)
			meta.__newindex(nil,tracks,nil)
			--]]
			--[[
			if tracks.IsPlaying == true then
				if clone:FindFirstChild("Animation") == nil then
					anim = Instance.new("Animation")
					anim.AnimationId = tracks.Animation.AnimationId
					anim.Parent = clone
					animplay = clone.Humanoid:LoadAnimation(anim)
				else
					anim.AnimationId = tracks.Animation.AnimationId
					animplay:Play()
				end
			else
				anim.AnimationId = tracks.Animation.AnimationId
				animplay:Play()
			end
			--]]
			--[[
			if clone:FindFirstChild("Animation") == nil then
				newanim = Instance.new("Animation")
				newanim.AnimationId = tracks.Animation.AnimationId
				currentid = newanim.AnimationId
				newanim.Parent = clone
				animplay = clone.Humanoid:LoadAnimation(newanim)					
				animplay:Play()	
			else
				print(currentid)
				--print("else else")
				newanim.AnimationId = tracks.Animation.AnimationId
				newanim:GetPropertyChangedSignal("AnimationId"):Connect(function()
					if newanim.AnimationId ~= currentid then
						animplay:Stop()
						wait(0.02)
						newanim:Destroy()
					end
				end)	
			end			
			--]]
		end
		--[[
		for _, descendant in pairs(clone:GetDescendants()) do
			if descendant:IsA("Motor6D") then
				local realMotor = part:FindFirstChild(descendant.Name, true)
				if realMotor then
					descendant.Transform = realMotor.Transform
				end
			end
		end
		--]]
	end)
end

AuraRead(obj)

Anyone wanna help? i just want the cloned character to mimic the animation currently playing on a original character.

Does anything output in console after the 3rd time?

Yeah, i tried printing the currentid, in the first time it currently prints one id, when u update the animation a second time, it still prints one id, but when u update the animation a third time; it prints second id. (the animation id from second time, the animation id from third time)

Are there any error messages after the 3rd time?

Probably; since if it prints second id, i have a possibility that there will be an error appearing:
(animation exceed at 256 track) but well since i stop testing too fast, i can’t tell.

Are you testing this on an empty baseplate? If so could you send the file so I could try some things

Alright.
Auraread.rbxm (17.6 KB)

(if u dont know how to upload rbxm just open place and put rbxm to roblox studio then you can now use it)
Also if you want to see how to replicate the issue; just update the animation id on the MimicTest on Script > Update1 and keep updating it until 3 times to see difference.

This is really confusing, what is “obj” in your line 5 supposed to be? It just errors every time.

Oh yeah, you need to set obj value to MimicTest; the obj object value was just suppose to be so i can edit the obj value to that object so i can see it.

I couldn’t get it to work, sorry! Good luck though

ooo you cant get the rbxm to work? i could help if i post the place file for you to test if you want