Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

2 comments

0

Quick question, does the arm have a mesh that you are trying to copy to the new arm?

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

2 answers

✓ Accepted answer

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

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.

2 comments

0

I do know this, I just wanted to know how I would get to it

0

I can possibly write it on here what is the full name of the texture thing

This discussion is preserved as it was. New answers, comments, and votes are closed.