#Changing Leg Mesh IDs

67 messages · Page 1 of 1 (latest)

silent jewel
#

You spelt humanoid wrong on the second line

#

Also you should use variables rather than writing massive lines of code

#

There is no need to write game.players.localplayer.character

#

Try it

#

Y would that affect anything?

#

What r u trying to do?

#

Also on line 2 you did “.FindFirstChild

#

Ok

#

Does it work?

#

Oh

#

Are there any errors?

grizzled root
#

studio** You are now Level 1! **studio

silent jewel
#

Ohhhh

#

It’s left leg not leftleg

#

Well the findfirst child return nil meaning it cant find anything called leftleg

#

Oh wait

#

I’ve just seen it xd

#

dude

#

The body parts aren’t inside the humaniid

#

Do character:findfirstchild

#

Not character.humaniid:findfirstchild

#

Let me see code

#

Are there any errors

#

Also if ur going to change the mesh id for a part, you should probs do it on a server script not a local one

#

Do you actually have a mesh inside the leg

#

Some parts come with meshes like the head

#

But legs dont

#

What you could do is do mesh = left leg:findfirstchild(“mesh”) or instance.new(“mesh”, leftleg)

#

Instance.new just makes new parts

#

Also ur script is really messy

#

What i would do is put services like players at the top

#

E.g

#

Local players = game:getservice(“players”)

#

Rather than doing stufff like game.players.localplayer.character.blahblabababa

grizzled root
#

studio** You are now Level 2! **studio

silent jewel
#

Yes because it makes the script ez to edit

#

Getting there

#

Only problem is that wouldn’t work since you need the character

#

So make another variable called character

#

And then use that

#

Make another variable called character

#

Local character= player.character or player.characteradded:wait()

#

Nice!

#

Ok now inside the mouseclick function make a variable for the mesh

#

Do local mesh = leftleg:findfirstchild(“mesh”) or instance.new(“mesh”,leftleg)

#

Local since ur making another variable

#

This is going to be complicated since ur doing this for both legs

#

I think u got confused

#

It would be leftleg:findfirstchild(“mesh”) or instance.newblahblahblah

#

Oh right

#

Thats because you can just say left leg

#

You need to do character[“left leg”]

#

Sure

#

I think you still dont rlly understand

#

Im on my phone rn so i cant write it out

#

Do you mind if i come back later on pc?

#

7hrs

silent jewel
#

r u still there?

silent jewel
#

uk

#

i made it ```lua
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

local button = script.Parent

local function findMesh(part)
local mesh = part:FindFirstChild("Mesh") or Instance.new("SpecialMesh",part)
return mesh
end

button.MouseButton1Up:Connect(function()
local leftleg = character:FindFirstChild("Left Leg")
local rightleg = character:FindFirstChild("Right Leg")

if leftleg then
    local leftmesh = findMesh(leftleg)
    leftmesh.MeshId = "rbxassetid://4450773061"
end
if rightleg then
    local rightmesh = findMesh(rightleg)
    rightmesh.MeshId = "rbxassetid://4450771439"
end

end)

#

one problem

#

this has been done on the client

#

i'm wasn't really sure what you were trying to do so i didnt say anything but if you were to use this in game, only you would be able to see the changes to your legs since it has been done in a local script

#

ok i just remade it but used local script and server script
(local)

local rs = game:GetService("ReplicatedStorage")
local changelegsFire = rs:WaitForChild("changelegs")

local button = script.Parent

button.MouseButton1Up:Connect(function()
    changelegsFire:FireServer()
end)

(server)

local rs = game:GetService("ReplicatedStorage")
local changelegsFire = rs:WaitForChild("changelegs")
changelegsFire.OnServerEvent:Connect(function(player)
    local character = player.Character
    local button = script.Parent.Parent

    local function findMesh(part)
        local mesh = part:FindFirstChild("Mesh") or Instance.new("SpecialMesh",part)
        return mesh
    end

    button.MouseButton1Up:Connect(function()
        local leftleg = character:FindFirstChild("Left Leg")
        local rightleg = character:FindFirstChild("Right Leg")

        if leftleg then
            local leftmesh = findMesh(leftleg)
            leftmesh.MeshId = "rbxassetid://4450773061"
        end
        if rightleg then
            local rightmesh = findMesh(rightleg)
            rightmesh.MeshId = "rbxassetid://4450771439"
        end
    end)
end)
silent jewel
#

Lemme see ur script

grizzled root
#

studio** You are now Level 3! **studio

silent jewel
#

local goes inside the ui and server goes inside local