Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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)

3 comments

0

Texture is misspelled in line 16. Recreated your method. It should be working after you fix that spelling error.

0

Oh, right... of course... umm, yeah, slightly embarrassing. haha thanks

0

So now the potato is gray.

1 answer

✓ Accepted answer

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 comment

1

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.