How to make a NPC copy local players looks

Hello there! It’s me again, I need help on how to make an NPC copy the local players looks, (meaning the player playing rn) I’ve searched the whole DevForum but still can’t find anything.

image
Here’s whats in the NPC (pretty obvious cuz he’s just a rig)

I hope you can help, thanks!

try

Humanoid1:ApplyDescription (player.Character.Humanoid:GetAppliedDescription ( ))

Humanoid1 should be the humanoid that needs to

player should be the player that needs to be copyd

1 Like
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local description = humanoid:WaitForChild("HumanoidDescription")
local npc = workspace:WaitForChild("NPCstats")
local npcHumanoid = npc:WaitForChild("Humanoid")
local clone = description:Clone()
npcHumanoid:ApplyDescription(clone)

StarterPlayerScripts if you only want it to execute when the local player first joins, StarterCharacterScripts if it should execute each time the player’s character model reloads (spawns).

What does this mean?

Why is there a double colon in the error?

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local description = humanoid:WaitForChild("HumanoidDescription")
local npc = workspace:WaitForChild("NPCstats")
local npcHumanoid = npc:WaitForChild("Humanoid")
npcHumanoid:ApplyDescription(description)

Also I was cloning the description before (which isn’t really necessary) you can just use the character’s description directly instead.

1 Like

Thanks where do I put this, and is it a local script?

It’s a local script and either of the two folders inside the StarterPlayer folder.

If you want it so if a player joins, it copies the player’s avatar and puts it into the dummy
Use a server script
Put it in serverscriptservice
Put this in:

local players = game:GetService("Players")
local npc = -- PUT NPC HERE

players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(chr)
		npc:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(plr.UserId))
		for i, a in pairs(npc.Parent:GetChildren()) do
			if a:IsA("CharacterMesh") then
				a:Destroy()
			end
		end
    end)
end)

Hmm, why does it still not work?

put the path of your npc into the local npc…

Yea, Idk what does that mean pls help

bruh… that’s like basic stuff, either way, ur dummy is inside workspace right?
WORKSPACE.NPCSTATS

idk if this works but maybe you can copy the players character then change the cframe to the npc’s?

wdym change cframe to the npcs? teleporting or?

`local npc = game.Workspace:FindFirstChild("YOUR_NPC_NAME")`
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
repeat wait()
	char.Archivable = true
	local clone = char:Clone()
	for _, i in pairs(clone:GetDescendants()) do
		if i:IsA("MeshPart") then
			i.Anchored = true
			i.Position = npc:FindFirstChild(i.Name).Position
			i.Orientation = npc:FindFirstChild(i.Name).Orientation
		end
		if i:IsA("Part") then
			i.Anchored = true
			i.Position = npc:FindFirstChild(i.Name).Position
			i.Orientation = npc:FindFirstChild(i.Name).Orientation
		end
	end
	char.Archivable = false
	clone.Parent = npc
until game:IsLoaded()
-- localscript in StarterPack`Preformatted text`
1 Like

For some reason theres a problem in i.position

You can easily clone a player by using CreateHumanoidModelFromUserId.

The following will create a clone of every player who joins the game:

local Players= game:GetService("Players")
local spawnPos = 0

local function cloneCharacter(playerID, playerName)
	local clonePlayer = Players:CreateHumanoidModelFromUserId(playerID)
	clonePlayer.Name = playerName
	local newPosX = clonePlayer.PrimaryPart.Position.X + spawnPos
	clonePlayer.PrimaryPart.Position = Vector3.new(newPosX, 6, 0) 
	clonePlayer.Parent = workspace
	spawnPos += 5
end

Players.PlayerAdded:Connect(function(player)
	local player = Players.LocalPlayer or Players:GetPropertyChangedSignal("LocalPlayer"):wait()
	cloneCharacter(player.userId, player.Name)
end)

Put the above into a script in ServerScriptService.