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

Is it possible to do Instance.new then quickly insert a mesh to the new part?

Asked by 7 years ago

I want to make a tycoonish game with droppers that will drop coins. But then I have the coin mesh but I have no idea how to create a new part and quickly add a mesh to it. Help please?

1 answer

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

Yes. Simply use Instance.new to create the Part, and the Mesh - and then edit their Properties to your need.

local coin = game.ReplicatedStorage.Coin;   --Reference coin
local coinMesh = coin.Mesh.MeshId;      --Get coin's meshid

local p = Instance.new("Part");         --Create new part
p.Size = Vector3.new(1,1,1);                --Edit properties
p.CFrame = CFrame.new(0,10,0);
p.Transparency = .5;

local m = Instance.new("SpecialMesh",coin);     --Create new mesh
m.MeshId = coinMesh                     --Set MeshId to coin's mesh
p.Parent = workspace;                       --Parent the new 'coin'
Ad

Answer this question