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

How to make a tool that changes Humanoid Mesh and Texture?

Asked by 8 years ago

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.

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'? TheDeadlyPanther 2460 — 8y
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? Doom10000 5 — 8y

Answer this question