You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I just want to update the animation on ViewportFrame smoothly; -
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. -
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)