Hello, I want to achieve a NPC for a credit section showing your avatar on top of a stand doing a animation
The issue is, its not loading the NPC and not doing the animation.
I tried making the animation into 2 scripts, etc.
It should use game.Players:GetCharacterAppearanceAsync(UserId)
but right now, my script is
local Model = script.Parent
local autoUpd = true
local autoRefreshDuration = 60
local function resetModel()
for i,v in pairs(Model:GetChildren()) do
if v:IsA('CharacterMesh') or v:IsA('Shirt') or v:IsA('Pants') or v:IsA('Accessory') or v:IsA('ShirtGraphic') then
v:Destroy()
end
end
if Model.Head:findFirstChild('Mesh') then
Model.Head.Mesh:Destroy()
end
end
local function updateModel()
local UserId = Model.UserId.Value
local AppModel = game.Players:GetCharacterAppearanceAsync(UserId)
for i,v in pairs(AppModel:GetChildren()) do
if v:IsA('SpecialMesh') or v:IsA('BlockMesh') or v:IsA('CylinderMesh') then
v.Parent = Model.Head
elseif v:IsA('Decal') then
Model.Head.face.Texture = v.Texture
elseif v:IsA('BodyColors') or v:IsA('CharacterMesh') or v:IsA('Shirt') or v:IsA('Pants') or v:IsA('ShirtGraphic') then
if Model:findFirstChild('Body Colors') then
Model['Body Colors']:Destroy()
end
v.Parent = Model
elseif v:IsA('Accessory') then
v.Parent = Model
v.Handle.CFrame = Model.Head.CFrame * CFrame.new(0, Model.Head.Size.Y / 2, 0) * v.AttachmentPoint:inverse()
end
end
if not Model.Head:FindFirstChild('Mesh') then
local m = Instance.new('SpecialMesh', Model.Head)
m.MeshType = Enum.MeshType.Head
m.Scale = Vector3.new(1.25, 1.25, 1.25)
end
end
updateModel()
if autoUpd then
while wait(autoRefreshDuration) do
resetModel()
updateModel()
end
end```
-- This is my animation script
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://3333499508"
local controller = script.Parent.AnimationController
controller:LoadAnimation(anim):Play()