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

How can I add a "mesh" texture to this Tycoon Dropper Script ?

Asked by 7 years ago

I got this basic script that I would like to modify to add a mesh to the part. For information, this script is from a Zednov Tycoon Kit. Here is the script :

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

while true do
    wait(1.5) -- How long in between drops
    local part = Instance.new("Part",workspace.PartStorage)
    part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
    part.Material=script.Parent.Parent.Parent.MaterialValue.Value
    local cash = Instance.new("IntValue",part)
    cash.Name = "Cash"
    cash.Value = 5 -- How much the drops are worth
    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    part.FormFactor = "Custom"
    part.Size=Vector3.new(1.2, 1.2, 1.2) -- Size of the drops
    part.TopSurface = "Smooth"
    part.BottomSurface = "Smooth"
    game.Debris:AddItem(part,20) -- How long until the drops expire
end``

4 answers

Log in to vote
0
Answered by
AZDev 590 Moderation Voter
7 years ago
Edited 7 years ago

I'm assuming you want to use a roblox mesh. Not a mesh part.

In which case you would add this to your loop:

local Mesh = Instance.new("SpecialMesh", part)
Mesh.MeshType = Enum.MeshType.FileMesh
Mesh.MeshId = "Put the ID of your mesh here"

-- Simple enough.
-- Usually I would try to provide wiki links and such to help you learn but this doesn't seem
-- applicable here.
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
wait(2)
workspace:WaitForChild("PartStorage")

while true do
    wait(1.5) -- How long in between drops
    local part = Instance.new("Part",workspace.PartStorage)
part.Name=("PartOfCash")--if your dropper has a theme etc add t he name to partofcash so it doesnt mesh other parts!!
local meshpart=Instance.new("SpecialMesh",workspace.PartStorage.PartOfCash)--this creates a SpecialMesh! inside of a part!! to remember to change the PartOfCash inside of it aswell!!--
meshpart.MeshType=("FileMesh")
meshpart.MeshId=("idhere")--add a id
meshpart.TextureId=("Textureidhere")--add a texture id here!!    
part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
    part.Material=script.Parent.Parent.Parent.MaterialValue.Value
    local cash = Instance.new("IntValue",part)
    cash.Name = "Cash"
    cash.Value = 5 -- How much the drops are worth
    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    part.FormFactor = "Custom"
    part.Size=Vector3.new(1.2, 1.2, 1.2) -- Size of the drops
    part.TopSurface = "Smooth"
    part.BottomSurface = "Smooth"
    game.Debris:AddItem(part,20) -- How long until the drops expire
end``

NOTE THERES A CHANCE THIS WONT WORK BECAUSE I DID THIS WITHOUT CHECKING FOR ERRORS!

0
Would really love if you accepted either one of our answers. Coolboyok11 64 — 7y
Log in to vote
0
Answered by 7 years ago

a mesh? So go to a .obj file maker or get one from the store, then save your mesh as .obj and then put a mesh in the brick, make the mesh a filemesh and open the .obj file!

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

Well this is working for me, you just need to put your mesh in Server Storage and name it "Mesh" .

(Thats the original script from Zednov Tycoon Kit with the lines that I added for the mesh)

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

while true do
    wait(1.5) -- How long in between drops
    local part = Instance.new("Part",workspace.PartStorage)
    part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
    part.Material=script.Parent.Parent.Parent.MaterialValue.Value

    local mesh = game.ServerStorage.Mesh:clone() -- This clones the mesh,
    mesh.Parent = part   -- Into the part!

    local cash = Instance.new("IntValue",part)
    cash.Name = "Cash"
    cash.Value = 5 -- How much the drops are worth
    part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
    part.FormFactor = "Custom"
    part.Size=Vector3.new(1, 1, 0.25) -- Size of the drops
    part.TopSurface = "Smooth"
    part.BottomSurface = "Smooth"
    game.Debris:AddItem(part,20) -- How long until the drops expire
end

If it worked, please Accept the answer!

Any questions? Ask the in the comments!

Have a nice day!

Answer this question