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

How Do I Change This Script To Drop A Mesh?

Hello, I Am A Noob At Scripting And I Am Wondering How I Would Change This Script To Drop A Mesh.

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

while true do
	wait(2.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 = 10 -- 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
end

1 answer

Well to answer your question, this works by Adding an Instance SpecialMesh to the part

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

while true do
    wait(2.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 = 10 -- 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"
local mesh = Instance.new('SpecialMesh',part)
	mesh.MeshId = 'rbxassetid://'.. -- Add the meshId here
	mesh.TextureId = 'rbxassetid://'.. -- Add the TextureId here
    game.Debris:AddItem(part,20) -- How long until the drops expire
end

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