eg -
function CreatePart(Name,Size)
Part = Instance.new("Part",workspace)
Part.Name = Name
Part.Size = Vector3.new(Size)
end
Is this how it would work or am I going about it in the wrong way?
eg -
function CreatePart(Name,Size)
Part = Instance.new("Part",workspace)
Part.Name = Name
Part.Size = Vector3.new(Size)
end
Is this how it would work or am I going about it in the wrong way?
You can either have 4 parameters, with 3 of them as the elements of the Vector3 value:
function CreatePart(Name, x, y, z)
With line 4 as:
Part.Size = Vector3.new(x, y, z)
OR
You can have 2 parameters, with one of them the whole Vector3 value itself:
This is what Perci1 means to "supply the Vector3 when [Perci1] call the function."
function CreatePart(Name, Vector3Value)
With line 4 as:
Part.Size = Vector3Value
Option 1
CreatePart(ExampleName, 1, 1, 1)
Option 2
CreatePart(ExampleName, Vector3.new(1, 1, 1))
Thanks this helped a lot!
You're welcome. :)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
This is fine, except you should use a local variable (they're faster). Also I would probably just set Size directly to the Size argument then supply the Vector3 when i call the function.