For example lest say that I add a Special Mesh into a brick using this code- and I set up a id for it to
local BananaID = 'http://www.roblox.com/asset/?id=1337' Instance.new('SpecialMesh')
How do you add the BananaID into the mesh ?
Hey there.
To act upon the properties of a new instance, you assign that new instance to a local
variable. So let's say I was creating a new part, and I wanted to call it "brick". The code would look like this...
local brick = Instance.new ("Part")
This assigns the local variable brick to your new part. Now, you can change the properties of this part, by referencing its variable. So, let's say I wanted to change it's position to 0,0,0. The code would look like this:
local brick = Instance.new ("Part") brick.Position = Vector3.new (0,0,0)
This principle can be used with any property, of any new instance you create, if you know how to use the property correctly.
Hope this helps. Good luck.
Store a variable to the instance first:
local mesh = Instance.new'SpecialMesh' --\\Create the mesh
Then set the meshType to FileMesh
mesh.MeshType = Enum.MeshType.FileMesh --\\Set the mesh type
Then set the meshId
mesh.MeshId = BananaID --\\Set the mesh's ID
Make sure you have already defined BananaID!
Let me put it all together for you in one block of code. Here is the code and I will commentate along the way to explain what each line does.
local mesh = Instance.new("SpecialMesh"); -- A Variable set for the instance of Special Mesh. local BananaID = "http://www.roblox.com/asset/?id=1337"; -- Variable for the ID that you defined in your code. mesh.MeshType = "FileMesh"; -- Changes the Special Mesh's MeshType to FileMesh. mesh.MeshId = BananaID; -- Sets the MeshId property of the Special Mesh to the ID that the variable is defined as.
If you see the semi-colons do not worry about them Lua does not require them and I am trying to get used to putting them at the end of every line of my code since, most other programming languages use semi-colons.
Well, there ya go and I hope I made some sense of the code and sorry if my explaination is a bit out of wack. No one explained those to me in person I just had to get them self-taught.
~~ KingLoneCat