So I want to load the player’s character into a dummy in a localscript. But I have no idea how.
I know there’s “GetHumanoidDescriptionFromUserId()
” and “ApplyDescription()
” for that, but that’s for server scripts only. And I want that the players see their character in the dummy.
Anybody knows how to do it?
1 Like
So basically you want a clone of your target?
Not fully sure what you are trying to exactly do but here’s something which might work:
-- Get the player's character
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
-- Get the dummy object to load the character into
local dummy = workspace.Dummy
-- Clone the character into the dummy
local clonedCharacter = character:Clone()
clonedCharacter.Parent = dummy
clonedCharacter:SetPrimaryPartCFrame(dummy.PrimaryPart.CFrame)
-- Disable the original character
character:Destroy()
1 Like
I want to load the character’s appearance inside a dummy.
This should work:
-- Get the player's character and humanoid description
local player = game.Players.LocalPlayer
local character = player.Character
local humanoidDescription = character.Humanoid:GetAppliedDescription()
-- Create a dummy part to display the appearance
local dummy = Instance.new("Part")
dummy.Size = Vector3.new(2, 3, 1)
dummy.Color = Color3.fromRGB(255, 255, 255)
dummy.Anchored = true
dummy.CanCollide = false
dummy.CFrame = CFrame.new(Vector3.new(0, 5, 0))
dummy.Parent = workspace
-- Apply the humanoid description to the dummy
local humanoid = Instance.new("Humanoid")
humanoid.Parent = dummy
local success, err = pcall(function()
humanoid:ApplyDescription(humanoidDescription)
end)
if not success then
warn("Failed to apply humanoid description: " .. tostring(err))
end
humanoid:ApplyDescription() can only be called by the server.
1 Like
Oh yes, my mistake.
-- Get the player's character
local player = game.Players.LocalPlayer
local character = player.Character
-- Create a new Part instance to represent the dummy
local dummy = Instance.new("Part")
dummy.Name = "Dummy"
dummy.Anchored = true
dummy.CanCollide = false
dummy.CFrame = character.HumanoidRootPart.CFrame
dummy.Parent = workspace
-- Clone the player's character model and parent it to the dummy part
local clonedCharacter = character:Clone()
clonedCharacter.Parent = dummy
-- Disable the player's character so it doesn't interfere with the dummy
character:Destroy()
This should hopefully work in a localscript.
1 Like
You do still have to set the character’s Archivable to true in order to clone it. By default, a Player’s character’s Archivable is set to False.
Not sure if I’m being dumb, but would this work?
-- Get the player's character
local player = game.Players.LocalPlayer
local character = player.Character
-- Set the character's Archivable property to true
character.Archivable = true
-- Create a new Part instance to represent the dummy
local dummy = Instance.new("Part")
dummy.Name = "Dummy"
dummy.Anchored = true
dummy.CanCollide = false
dummy.CFrame = character.HumanoidRootPart.CFrame
dummy.Parent = workspace
-- Clone the player's character model and parent it to the dummy part
local clonedCharacter = character:Clone()
clonedCharacter.Parent = dummy
-- Disable the player's character so it doesn't interfere with the dummy
character:Destroy()
1 Like