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

How to change the texture for a mesh? (dropper tycoon)

Asked by 7 years ago

Okay, so I am making a tycoon, and I need the droppers to drop potatoes, which I have done. Now I just need the texture for it. Here's what I tried to use:

mesh.TexureId = "rbxassetid://81684482"

Here is the code for the dropper so far.

wait(2)
workspace:WaitForChild("PartStorage")


deb = true 
script.Parent.Clicker.ClickDetector.MouseClick:connect(function(wat)
    if deb == true then
        deb = false
    local part = Instance.new("Part",workspace.PartStorage)
    part.BrickColor= BrickColor.new ("Gold")
    part.Material=script.Parent.Parent.Parent.MaterialValue.Value
            local mesh = Instance.new("SpecialMesh")
            mesh.Parent = part
            mesh.MeshType = "FileMesh"
            mesh.MeshId = "rbxassetid://81684482"
            mesh.TexureId = "rbxassetid://81684482"
            mesh.Scale = Vector3.new(3,3,3)
    local cash = Instance.new("IntValue",part)
    cash.Name = "Cash"
    cash.Value = 1 -- How much the drops are worth
    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.6,0)
    part.FormFactor = "Custom"
    part.Size=Vector3.new(1.4, 1.4, 1.4) -- Size of the drops
    part.TopSurface = "Smooth"
    part.BottomSurface = "Smooth"
    game.Debris:AddItem(part,20) -- How long until the drops expire
            wait(.15)
            deb = true
    end
end)
0
Texture is misspelled in line 16. Recreated your method. It should be working after you fix that spelling error. TofuBytes 500 — 7y
0
Oh, right... of course... umm, yeah, slightly embarrassing. haha thanks Pot8o_Penguin 50 — 7y
0
So now the potato is gray. Pot8o_Penguin 50 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

A meshId can only be set in the property panel, so it is staying grey because the script is unable to change the texture unfortunately.

You should be able to use a special mesh and change the ID from a script, though:

http://wiki.roblox.com/index.php?title=API:Class/SpecialMesh

Hope that helps!

EDIT: Oh, just realised you are using a special mesh. Try the ID in a mesh normally, and if it is still grey, subtract 1 from the end and so on, until you get the right texture! Then you can use that ID!

1
Thanks! Pot8o_Penguin 50 — 7y
Ad

Answer this question