I'm a fairly new coder and still grasping many of the concepts Lua offers, but one thing I'm having trouble with is creating a tool that, when activated by click, changes the user's body parts to selected MeshIds and TextureIds.

There has to be a simple, perhaps 40 or less line code to do this, right?

Here's what I've been trying to tinker with...

script.Parent.Equipped:connect(function(m)
m.Button2Down:connect(function()
	if hit.Parent == nil then return end
	if (hit.Parent:findFirstChild("Humanoid") == nil) then return end
	local human = hit.Parent:findFirstChild("Humanoid") 
	local char = hit.Parent
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if (human ~= nil) and debounce == false then
		debounce = true
		originals = char:getChildren()
		for w = 1, #originals do
			if originals[w].className == "CharacterMesh" then
				originals[w]:remove()
			end
		end
		meshes = script:getChildren()
		for y = 1, #meshes do
			copy = meshes[y]:clone()
			copy.Parent = char
		end
	end
	wait(5)
	debounce = false
end)
end)

I'd much rather a way to either have the Character Meshes available as part of the tool or simply put the OverlayTextureId = "www.roblox.com/asset?id=########"

Sorry if what I'm saying or showing doesn't make sense. Objective: Tool that changes user's character mesh AND texture upon left click usage.

2 comments

0

That's right clicking, not left clicking. 'hit' isn't defined, either, why are you using it? Is this tool being used to change a player's mesh, etc. when you click them, or is being used as like clothing item that you 'equip'?

0

I'd prefer it to be used to change the user's mesh/texture; I'll switch it to Button1, but how can I fix/change the hit to work with it?