How can I make the NPC look like the player and do a animation

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()
1 Like

Are you wanting this to be only visilbe on the client or are you wanting it to be visible on the server?

What I tried doing when I was making mine was just creating a straight clone of the player’s avatar and copying an animate script into it. If you are doing this completely client side you’d need to make animations and such in a local script inside playerscripts.

This is probably the easiest way to do it from what i’ve seen, and does not require an autorefresh.

Why don’t you just clone the character?

Character.Archivable = true 
local newCharacter = Character:Clone()
newCharacter:MoveTo(--Position)

Hey there, don’t confuse yourself with complicated scripts, i would suggest you use just simple block rig and make it stand on the stand and do the animations, after you do whatever you desire with the plain dummy we’ll be changing the dummy into the player.
It’s as simple as this!

local dummy = game.workspace.Dummy --change this
 
dummy.Humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(game.Players.LocalPlayer.UserId))

I want this client side, right now, I am gonna try out the previous responses.

Alright. If you would like this is my solution for client sided:

LocalScript:

local player = game.Players.LocalPlayer
player.Character.Archivable = true

local clone = player.Character:Clone()

local anim = clone.Humanoid:LoadAnimation(script.Animation)

anim.Looped = true
anim:Play()

It would be Clone.Humanoid not player.Character, since he wants the clone doing the animation.

1 Like

Thank you I didn’t see that haha