Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get the players accessories to be where they should?

Asked by 2 years ago

Hello. I've made a script that clones the player's character and positions the limbs etc. where I want them to be. The problem is that the player's accessories do not stay on the character because they only get moved to the Origin Position since the script is moving everything (the whole model) to there. I can not tell what each accessory's position should be since it depends on what the player is wearing. I've read about welding the accessories to the head, but I couldn't figure out how to get it to work.

Any help is appreciated!

game.ReplicatedStorage.ClonePlayerBasement.OnServerEvent:Connect(function(playername)
function cloneCharacter(character)
    character.Archivable = true
    local fake = character:clone()
    character.Archivable = false
    return fake
end

    local clone = cloneCharacter(playername.Character)
    clone.Parent = workspace
    clone.Name = "DeadPlayerModel"
    local clonechildren = clone:GetChildren()
    for i,v in pairs(clonechildren) do
    if v:IsA("BasePart") then
        v.Anchored = true
    elseif v:IsA("Part") then
        v.Anchored = true
--  elseif v:IsA("Accessory") then
--      v:Destroy()
    end
    end
    clone.PrimaryPart = clone.HumanoidRootPart
    clone:MoveTo(Vector3.new(59.275, 4.935, -1622.773))
    clone.Head.Position = Vector3.new(59.062, 4.659, -1620.832)
    clone.Head.Orientation = Vector3.new(62.01, -138.22, -136.78)
    clone.HumanoidRootPart.Position = Vector3.new(59.233, 4.713, -1622.293)
    clone.HumanoidRootPart.Orientation = Vector3.new(85, 175.02, -179.98)
    clone["Left Arm"].Position = Vector3.new(57.407, 4.694, -1622.237)
    clone["Left Arm"].Orientation = Vector3.new(85, 175.02, 155.02)
    clone["Left Leg"].Position = Vector3.new(58.797, 5.928, -1623.953)
    clone["Left Leg"].Orientation = Vector3.new(25, 175, 175)
    clone["Right Arm"].Position = Vector3.new(60.831, 4.705, -1622.069)
    clone["Right Arm"].Orientation = Vector3.new(85, 175.02, -169.98)
    clone["Right Leg"].Position = Vector3.new(59.917, 5.923, -1623.852)
    clone["Right Leg"].Orientation = Vector3.new(25, 175, -170)
    clone.Torso.Position = Vector3.new(59.233, 4.713, -1622.293)
    clone.Torso.Orientation = Vector3.new(85, 175.02, -179.98)
end)
0
Why don't you just use clone:SetPrimaryPartCFrame() or clone:MoveTo() rabbi99 714 — 2y
0
I used clone:MoveTo() in my script aswell? My problem is not the character, but the accessories the character has. They are not positioned right. purplxboi 2 — 2y

Answer this question