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

Tycoon dropping meshes instead of parts?

Hi, I'm currently working on a tycoon project and I would like assistance with transforming this script to be able to drop meshes instead of parts, all help is greatly appreciated! Thanks :).

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

while true do
	wait(1.5)
	local part = Instance.new("Part",workspace.PartStorage)
	part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
	part.Material=script.Parent.Parent.Parent.MaterialValue.Value
	local Robux = Instance.new("IntValue",part)
	Robux.Name = "Robux"
	Robux.Value = 2
	part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
	part.FormFactor = "Custom"
	part.Size=Vector3.new(2, 0.2, 0.8)
	part.TopSurface = "Smooth"
	part.BottomSurface = "Smooth"
	game.Debris:AddItem(part,20)
end

2 answers

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

	while wait(1.5) do -- I would recommend using `while wait() do` loop for this to happen every 1.5 secs
-- part properties
	local part = Instance.new("Part",workspace.PartStorage)
		part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
		part.Material=script.Parent.Parent.Parent.MaterialValue.Value
		part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,1.4,0)
		part.FormFactor = "Custom"
		part.Size = Vector3.new(2, 0.2, 0.8)
		part.TopSurface = "Smooth"
		part.BottomSurface = "Smooth"
-- mesh
		local mesh = Instance.new('SpecialMesh',part)  -- Adds the mesh to the part
		mesh.MeshType = 'FileMesh'
		mesh.MeshId = '' -- id of mesh
		mesh.TextureId = '' -- texture id
		mesh.Scale = Vector3.new(1,1,1) -- how big you want the mesh to be
-- robux
	local Robux = Instance.new("IntValue",part)
		Robux.Name = "Robux"
		Robux.Value = 2
		game.Debris:AddItem(part,20)
end
local mesh = Instance.new("Mesh")
mesh.MeshId = "" --Your mesh here
mesh.Parent = part

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