This code is meant to spawn meshes but it just spawns regular 1 by 1 by 1 blocks. what am I doing wrong?

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

local MeshRandomizer = {1,2} --How every many meshes you have 

----Mesh IDs------
local MeshRandomizer1 = "http://www.roblox.com/asset/?id=430070121" --After =, put the ID of the mesh
local MeshRandomizer2 = "http://www.roblox.com/asset/?id=430355436" --Same thing here. You can put as many MeshRandomizers as possible.

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 i = math.random(1, #MeshRandomizer) --Sets the random value
	local mesh = Instance.new("SpecialMesh",part) --Creates the mesh
	if MeshRandomizer[i] == 1 then
   		mesh.MeshId = MeshRandomizer1
	elseif MeshRandomizer[i] == 2 then
   	mesh.MeshId = MeshRandomizer2
end
	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

1 comment

0

Anyone?