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

how do i change a mesh texture and id when it is made with instance.new?

Asked by 5 years ago

this script is in the button which makes the meshpart appear:

script.Parent.MouseClick:Connect(function()
    local mpart = Instance.new("MeshPart",game.Workspace)
    mpart.Position = Vector3.new(236.04, 81.46, 36.46)
    mpart.MeshId = "rbxassetid://1107996700"
    mpart.TextureID = "rbxassetid://1107996710"
    mpart.Size = Vector3.new(4, 5, 5)
end)

when the meshpart appears it doesnt have the texture or mesh, its just the blank part and i need it to have the texture and meshid. thanks

0
you cant assign a MeshId to a MeshPart after running the game sadly, use a SpecialMesh instead GoldAngelInDisguise 297 — 5y

1 answer

Log in to vote
0
Answered by
Sorukan 240 Moderation Voter
5 years ago
Edited 5 years ago

Do this instead

    script.Parent.MouseClick:Connect(function()
        local mpart = Instance.new("SpecialMesh",game.Workspace)
        mpart.Position = Vector3.new(236.04, 81.46, 36.46)
        mpart.MeshType == Enum.MeshType.FileMesh
        mpart.MeshId = "rbxassetid://1107996700"
        mpart.TextureID = "rbxassetid://1107996710"
        mpart.Scale = Vector3.new(4, 5, 5) -- changed size to scale because meshes don't have sizes
    end)

0
Idk if the TextureID serves any purpose because i haven't tested this out yet but if it creates an error then remove it, else just keep it. Sorukan 240 — 5y
0
SpecialMesh should be parented under a part, not workspace GoldAngelInDisguise 297 — 5y
0
Get rid of the 3rd and 4th lines. SpecialMeshes doesn't have a Position property, it will return an error. And since you've created a SpecialMesh, you don't need to specify type FileMesh. Also, TextureID will return an error. Use TextureId instead (lowercapital "d"). proclet 7 — 5y
Ad

Answer this question