How do I make a script, that the model looks like the user who sees it

So I’m trying to make a dummy who looks exactly like the player who sees it. When there are multiple players then they all should see their own avatar as the dummy, not each other’s avatars, but I just can’t make it work and I don’t know what I’m doing wrong. I also couldnt find any information about it. Here is the script (It’s inside the dummy):

local Models = game.Players:GetCharacterAppearanceAsync(game.Players.LocalPlayer)
Models = script.Parent
wait()
for i,v in pairs(Models:GetChildren()) do
print(v.Name)
v.Parent = script.Parent
wait()
end

you have to run it through a local script, not a server script. Don’t put the localscript in the dummy, put it under playerscripts.

I believe you have to make a local clone of the dummy for you to be able to make local changes to it, try this in an area localscripts work like StarterPlayerScripts?

local dummy = --Your dummy
local clone = dummy:Clone()
clone.Parent = workspace
dummy:Destroy()

local plr = game.Players.LocalPlayer

local desc = game.Players:GetHumanoidDescriptionFromUserId(plr.UserId)

dummy.Humanoid:ApplyDescription(desc)

Make sure the dummy has a humanoid

REMEMBER, CODE BLOCKS

--[[ This is a codeblock ]]--
print("Hello World!")

For your question,
Are you trying to create a ScreenGui where the players Avatar is in the frame? Or are you trying to create a Dummy in the workspace that looks like the player when they join, but said Dummy looks like ONLY the player that joins on their screen (Not on the Server for all to see YOUR AVI).

Place this in a localscript in StarterPlayerScripts:

local Players=game:GetService("Players")
local Player=Players.LocalPlayer
local Model = Players:CreateHumanoidModelFromUserId(Player.UserId)
Model.Parent = workspace
Model.Name=Player.Name
local Loc= Vector3.new(0,0,0) -- Change this value to the location of where you want the model to be
Model:SetPrimaryPartCFrame(CFrame.new(Loc))
Model.HumanoidRootPart.Anchored=true
2 Likes

Doesn’t it spawn every person who joins into the same location? Everyone will still be able to see other clones. I want them to see only theirs

No, because it’s on a local script it will only spawn locally. So everyone will only see one model (their own)

Can I also give the clones an idle animation?

And how do I rotate him a bit? I’m sure I need to use Orientation

This is an old script I based off a tutorial (although I’m not quite sure if it’s a tutorial or not, it’s been a long time) a few months back, I hope it helps (Put it inside StarterGui)

local player = game.Players.LocalPlayer

repeat wait() until player.Character

function weldAttachments(attach1, attach2)
    local weld = Instance.new("Weld")
    weld.Part0 = attach1.Parent
    weld.Part1 = attach2.Parent
    weld.C0 = attach1.CFrame
    weld.C1 = attach2.CFrame
    weld.Parent = attach1.Parent
    return weld
end
 
local function buildWeld(weldName, parent, part0, part1, c0, c1)
    local weld = Instance.new("Weld")
    weld.Name = weldName
    weld.Part0 = part0
    weld.Part1 = part1
    weld.C0 = c0
    weld.C1 = c1
    weld.Parent = parent
    return weld
end
 
local function findFirstMatchingAttachment(model, name)
    for _, child in pairs(model:GetChildren()) do
        if child:IsA("Attachment") and child.Name == name then
            return child
        elseif not child:IsA("Accoutrement") and not child:IsA("Tool") then -- Don't look in hats or tools in the character
            local foundAttachment = findFirstMatchingAttachment(child, name)
            if foundAttachment then
                return foundAttachment
            end
        end
    end
end
 
function addAccoutrement(character, accoutrement)  
    accoutrement.Parent = character
    local handle = accoutrement:FindFirstChild("Handle")
    if handle then
        local accoutrementAttachment = handle:FindFirstChildOfClass("Attachment")
        if accoutrementAttachment then
            local characterAttachment = findFirstMatchingAttachment(character, accoutrementAttachment.Name)
            if characterAttachment then
                weldAttachments(characterAttachment, accoutrementAttachment)
            end
        else
            local head = character:FindFirstChild("Head")
            if head then
                local attachmentCFrame = CFrame.new(0, 0, 0)
                local hatCFrame = accoutrement.AttachmentPoint
                buildWeld("HeadWeld", head, head, handle, attachmentCFrame, hatCFrame)
            end
        end
    end
end

function SetDummy()
	local dummy = workspace.Dummy -- the dummy who will look exactly like the player
	local char = player.Character
	for i, v in pairs(char:GetChildren()) do
		if v:IsA("Accessory") then
			local clone = v:Clone()
			clone.Parent = dummy
			clone.Handle:FindFirstChild("AccessoryWeld"):Destroy()
			addAccoutrement(dummy, clone)
		end
		if v:IsA("BasePart") then
			dummy[v.Name].BrickColor = v.BrickColor
		end
		if v:IsA("Shirt") or v:IsA("Pants") then
			v:Clone().Parent = dummy
		end
	end
end

SetDummy()

I mean… It does work but It doesn’t change the avatar pack (My avatar is Robloxian 2.0 but it remains blocky like the dummy) it also won’t change the face or body scale.

Try this

local player = game.Players.LocalPlayer

repeat wait() until player.Character

function weldAttachments(attach1, attach2)
    local weld = Instance.new("Weld")
    weld.Part0 = attach1.Parent
    weld.Part1 = attach2.Parent
    weld.C0 = attach1.CFrame
    weld.C1 = attach2.CFrame
    weld.Parent = attach1.Parent
    return weld
end
 
local function buildWeld(weldName, parent, part0, part1, c0, c1)
    local weld = Instance.new("Weld")
    weld.Name = weldName
    weld.Part0 = part0
    weld.Part1 = part1
    weld.C0 = c0
    weld.C1 = c1
    weld.Parent = parent
    return weld
end
 
local function findFirstMatchingAttachment(model, name)
    for _, child in pairs(model:GetChildren()) do
        if child:IsA("Attachment") and child.Name == name then
            return child
        elseif not child:IsA("Accoutrement") and not child:IsA("Tool") then -- Don't look in hats or tools in the character
            local foundAttachment = findFirstMatchingAttachment(child, name)
            if foundAttachment then
                return foundAttachment
            end
        end
    end
end
 
function addAccoutrement(character, accoutrement)  
    accoutrement.Parent = character
    local handle = accoutrement:FindFirstChild("Handle")
    if handle then
        local accoutrementAttachment = handle:FindFirstChildOfClass("Attachment")
        if accoutrementAttachment then
            local characterAttachment = findFirstMatchingAttachment(character, accoutrementAttachment.Name)
            if characterAttachment then
                weldAttachments(characterAttachment, accoutrementAttachment)
            end
        else
            local head = character:FindFirstChild("Head")
            if head then
                local attachmentCFrame = CFrame.new(0, 0, 0)
                local hatCFrame = accoutrement.AttachmentPoint
                buildWeld("HeadWeld", head, head, handle, attachmentCFrame, hatCFrame)
            end
        end
    end
end

function ChangeMesh(char, dummyBD, meshID)
	dummyBD.MeshID = meshID
end

function SetDummy()
	local dummy = workspace.Dummy --your dummy here
	local char = player.Character
	for i, v in pairs(char:GetChildren()) do
		if v:IsA("Accessory") then
			local clone = v:Clone()
			clone.Parent = dummy
			clone.Handle:FindFirstChild("AccessoryWeld"):Destroy()
			addAccoutrement(dummy, clone)
		end
		if v:IsA("BasePart") then
			ChangeMesh(char, dummy[v.Name], char[v.Name].MeshID)
			dummy[v.Name].BrickColor = v.BrickColor
		end
		if v:IsA("Shirt") or v:IsA("Pants") then
			v:Clone().Parent = dummy
		end
	end
end

SetDummy()

That didn’t really change anything

Are there any errors in the output?

Try putting this in a local script in StarterPlayerScripts and change some of the values around?

local dummy = --Your dummy
local clone = dummy:Clone()
clone.Parent = workspace
dummy:Destroy()

local plr = game.Players.LocalPlayer

local desc = game.Players:GetHumanoidDescriptionFromUserId(plr.UserId)

clone.Humanoid:ApplyDescription(desc)

It makes a local clone of the dummy so each player has their own dummy and then it loads the HumanoidDescription of the player int othe dummy, your dummy needs a Humanoid

The Dummy’s name in the workspace remains Dummy or I have to change it?

Change it to your dummies name

MeshID is not a valid member of Part “Workspace.JartsGT.HumanoidRootPart”

Alright I see the problem here.

local player = game.Players.LocalPlayer

repeat wait() until player.Character

function weldAttachments(attach1, attach2)
    local weld = Instance.new("Weld")
    weld.Part0 = attach1.Parent
    weld.Part1 = attach2.Parent
    weld.C0 = attach1.CFrame
    weld.C1 = attach2.CFrame
    weld.Parent = attach1.Parent
    return weld
end
 
local function buildWeld(weldName, parent, part0, part1, c0, c1)
    local weld = Instance.new("Weld")
    weld.Name = weldName
    weld.Part0 = part0
    weld.Part1 = part1
    weld.C0 = c0
    weld.C1 = c1
    weld.Parent = parent
    return weld
end
 
local function findFirstMatchingAttachment(model, name)
    for _, child in pairs(model:GetChildren()) do
        if child:IsA("Attachment") and child.Name == name then
            return child
        elseif not child:IsA("Accoutrement") and not child:IsA("Tool") then -- Don't look in hats or tools in the character
            local foundAttachment = findFirstMatchingAttachment(child, name)
            if foundAttachment then
                return foundAttachment
            end
        end
    end
end
 
function addAccoutrement(character, accoutrement)  
    accoutrement.Parent = character
    local handle = accoutrement:FindFirstChild("Handle")
    if handle then
        local accoutrementAttachment = handle:FindFirstChildOfClass("Attachment")
        if accoutrementAttachment then
            local characterAttachment = findFirstMatchingAttachment(character, accoutrementAttachment.Name)
            if characterAttachment then
                weldAttachments(characterAttachment, accoutrementAttachment)
            end
        else
            local head = character:FindFirstChild("Head")
            if head then
                local attachmentCFrame = CFrame.new(0, 0, 0)
                local hatCFrame = accoutrement.AttachmentPoint
                buildWeld("HeadWeld", head, head, handle, attachmentCFrame, hatCFrame)
            end
        end
    end
end

function ChangeMesh(char, dummyBD, meshID)
	dummyBD.MeshID = meshID
end

function SetDummy()
	local dummy = workspace.Dummy --your dummy here
	local char = player.Character
	for i, v in pairs(char:GetChildren()) do
		if v:IsA("Accessory") then
			local clone = v:Clone()
			clone.Parent = dummy
			clone.Handle:FindFirstChild("AccessoryWeld"):Destroy()
			addAccoutrement(dummy, clone)
		end
		if v:IsA("BasePart") then
			dummy[v.Name].BrickColor = v.BrickColor
		end
        if v:IsA("MeshPart") then
			ChangeMesh(char, dummy[v.Name], char[v.Name].MeshID)
		end
		if v:IsA("Shirt") or v:IsA("Pants") then
			v:Clone().Parent = dummy
		end
	end
end

SetDummy()

MeshID is not a valid member of MeshPart “Workspace.JartsGT.RightLowerArm”