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

How to clone an exact replica of the player's arm?

Asked by
Bman8765 270 Moderation Voter
10 years ago

Okay, so I have a localscript inside a tool named Knife. Its primary function currently is to create the arms for the tool and then weld them. Here is my problem, the script clones the left arm but it looks nothing like what the characters left arm actually looks like. How do you get the players actual arm apparent? There has to be a way I just don't know how I would do it.

Here is the code(feel free to point out stuff I should change, having separate functions will be important in the future though so don't ask):

repeat wait() until game.Players.LocalPlayer
--------------------------------------------------------------
--Global Variables:
--------------------------------------------------------------
player = game.Players.LocalPlayer
c = player.Character
tool = script.Parent
debounce = false
--------------------------------------------------------------
--Creating the arms function
--------------------------------------------------------------
function makearmleft(armtype)
    if armtype == "left" then
        leftarm = script.Parent.Parent["Left Arm"]:Clone()
        leftarm.Parent = script.Parent
        print("the end")
    elseif armtype == "right" then
        print("RIGHT")
    end
end
--------------------------------------------------------------
--Welding the arms function
--------------------------------------------------------------
function weldarm(armtype)
    if armtype == "left" then
        local w1 = Instance.new("Weld", c)
        w1.Part0 = w1.Parent["Left Arm"] -- the item, This is your wall
        w1.Part1 = leftarm -- the item you want to weld to part0, this is your poster
        w1.C1 = CFrame.fromEulerAnglesXYZ(0, 0, 0) *CFrame.new(0, 0, 0) -- the cframe from the EulerAngles, first one changes the main angles, second is kinda like an offset
    elseif armtype == "right" then
        print("right arm")  
    end
end
--------------------------------------------------------------
--User Controls
--------------------------------------------------------------
function equippedtool()
    if debounce == false then
        debounce = true
        print("Equipped")
        makearmleft("left")
        weldarm("left")
        print("MADE IT")
        debounce = false
    end
end

function unequippedtool()
    leftarm:Destroy()
    --add rightarm
end

tool.Unequipped:connect(unequippedtool)
tool.Equipped:connect(equippedtool)
0
Quick question, does the arm have a mesh that you are trying to copy to the new arm? Trewier 146 — 10y
0
Yes, I know that's why it's not working but I don't know how to get the mesh and add it to this new brick Bman8765 270 — 10y

2 answers

Log in to vote
1
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

You're cloning the arm, but characters also have an object inserted into their Models called a CharacterMesh. This object modifies the appearance of the arm; without it, the arm is simply a block.

Unfortunately, this object only works inside a character. To make it work inside a regular brick, you must insert a SpecialMesh into the brick, then set the SpecialMesh's MeshId property to the CharacterMesh's MeshId property.

Note that the MeshId property for CharacterMeshes is just a number, while for SpecialMeshes it must be rbxassetid:// with a number.

mesh.MeshId = "rbxassetid://"..characterMesh.MeshId
Ad
Log in to vote
-3
Answered by 10 years ago

I don't know if you know but if your arm is not the default ROBLOX arm (the block arm) then in your character you have something not sure what it was called I thinking was ....texture. I'm on my phone right now so can't really tell but that's basically what makes the arm different. Hope I helped.

0
I do know this, I just wanted to know how I would get to it Bman8765 270 — 10y
0
I can possibly write it on here what is the full name of the texture thing PancakeAttacks 0 — 10y

Answer this question