So I basicly want to clone my character and place it in the same position and with the same rig as a dummy.
I have never made this before so I tried a simple solution that clearly didn’t work and then I tried to look up on the internet but i fount absolutely nothing.
These are two samples of code that I have tried:
WHAT I TOUGHT IT CAN BE
local insertService = game:GetService(“InsertService”)
game.Players.PlayerAdded:Connect(function(plr)
local Id = plr.UserId
local Model = insertService:LoadAsset(Id)
Model.Parent = workspace
end)
WHAT I HAVE FOUDN IN ANOTHER SCRIPT
if PlayAnimationInRig.currentId == userId then return end
PlayAnimationInRig.currentId = userId
PlayAnimationInRig.StopAnimationTrack()
PlayAnimationInRig.rig:Destroy()
PlayAnimationInRig.rig = PlayAnimationInRig.rigCopy:Clone()
PlayAnimationInRig.rig.Parent = script.Parent
local humanoidDescription = Players:GetHumanoidDescriptionFromUserId(userId)
PlayAnimationInRig.humanoid:ApplyDescriptionReset(humanoidDescription)
local tagClone = PlayAnimationInRig.tag:Clone()
tagClone.Enabled = true
tagClone.Parent = PlayAnimationInRig.rig.Head
PlayAnimationInRig.humanoid.DisplayName =
Players:GetNameFromUserIdAsync(userId)
So I tried your solution and I think it will work but I am getting this err:
attempt to index nil with getDescendants
here is the code:
game.Players.PlayerAdded:Connect(function(plr)
local playerModel = plr.Character:GetDescendants()
local dummy = workspace:WaitForChild(“Dummy”):GetDescendants()
for i, v in ipairs(playerModel) do
print(v)
dummy[v] = playerModel[v]
end
I don’t get the err. anymore but the model doesn’t change, it is still in its basic form
this is the code:
game.Players.PlayerAdded:Connect(function(plr)
repeat
task.wait()
until plr.Character ~= nil
local playerModel = plr.Character:GetDescendants()
local dummy = workspace:WaitForChild("Dummy"):GetDescendants()
for i, v in ipairs(dummy) do
print(v)
dummy[v] = playerModel[v]
end
It is working, thank you, but i do still have a problem, the character is in the basic state of staying on his foots but I want it as the original dummy, which is sitting
local dummy = workspace:WaitForChild(“Dummy”)
game:GetService(“Players”).PlayerAdded:Connect(function(plr)
dummy.Humanoid:ApplyDescription(game:GetService(“Players”):GetHumanoidDescriptionFromUserId(plr.UserId))
local char = plr.Character
plr.CharacterAdded:Wait(char)
char:WaitForChild(“Humanoid”)
char.Humanoid.JumpHeight = 0 -- if you are using jumppower, do char.Humanoid.JumpPower = 0
char.Humanoid.Sit = true
end)