I have absolutely no idea why this isn’t working. It functioned fine a while ago, however I changed a bit of code and now it doesn’t. It will run in a server script (with alterations to the player name of course), but not local.
local player = game.Players.LocalPlayer
local charac = workspace:WaitForChild(player.Name)
charac.Archivable = true
local clone = charac:Clone()
clone.Parent = workspace
clone.PrimaryPart = clone:WaitForChild("HumanoidRootPart")
clone:MoveTo(Vector3.new(19.581, 3.15, 25.422))
The error I receive is Infinite yield possible on Workspace.Player1:WaitForChild("HumanoidRootPart")'
the model of the player is copied, but it contains nothing
Roblox players have Archivable set to false, which prevents cloning from working. do Character.Archivable = true then clone the player. (Didn’t notice you already do, lol)
Oh, Do game.Workspace[player.Name]
For the love of god, please don’t… the LocalPlayer.Character variable exists for a reason and any objects named the same as the player might get caught which has caused issues for me
local player = game.Players.LocalPlayer
local character = player.CharacterAdded:Wait()
character.Archivable = true
local clone = character:Clone()
clone.Parent = workspace
clone.PrimaryPart = clone:WaitForChild("HumanoidRootPart")
clone:MoveTo(Vector3.new(19.581, 3.15, 25.422))
even with this, I recieve errors that indicate the character is nil or has no descendants.
all other scripts but the local script are disabled
trying the code as a startercharacter localscript seems to “work”, though it has missing cosmetics
you’ll have to wait for the appearance to load in, and if it’s not that i am out of ideas
I used this source code in the studio and it clones the model of a player correctly:
local player = game.Players.LocalPlayer
local charac = workspace:WaitForChild(player.Name)
charac.Archivable = true
local clone = charac:Clone()
if not clone:FindFirstChild("HumanoidRootPart") then
repeat
charac = workspace:FindFirstChild(player.Name)
clone = charac:Clone()
wait(0.1)
until clone:FindFirstChild("HumanoidRootPart")
end
clone.Parent = workspace
clone.PrimaryPart = clone:FindFirstChild("HumanoidRootPart")
clone:MoveTo(Vector3.new(19.581, 3.15, 25.422))
It really does depend on how fast internet and computer you have since the studio might miss look some things. I tested my script and it does fully clone my character to the workspace. WaitForChild() has a second parameter that you can use for a timeout to wait even more time for specific things, this most of the time fix the problems as you might have.