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 make a parameter with Vector3?

I've been doodling around with my new scripting skills lol and I tried making a parameter with vector 3 I don't know how to do it and cant find any tutorials please help me I would appreciate it when I click play the parts don't show up or spawn in.

Here's the script

function generatePart(name, position) local myPart = Instance.new("Part") myPart.Position = Vector3.new(position) myPart.Anchored = true myPart.BrickColor = BrickColor.new("Light pink") myPart.Transparency = 0.5 myPart.Name = name myPart.Parent = game.Workspace -- more efficient this way end

generatePart(1, 0,25,0) generatePart(2, 0,35,0) generatePart(3, 0,45,0) generatePart(4, 0,55,0)

1 comment

0

local position = Vector3.new(X, Y, Z) generatePart("name", position)

2 answers

For future questions please put the code in lua blocks so that we can understand it easier, but I was able to find your error.

Position only acts as the first parameter because it's a single variable,so you would need to use 3 variables like this

Local pos1,pos2,pos3 = 1,2,3

Part.Position = Vector3.new(pos1,pos2,pos3)

each argument you put in a function will be the same as the paramaters in the right order. try this:

function generatePart(name, position)
	local myPart = Instance.new("Part")
	myPart.Position = Vector3.new(position)
	myPart.Anchored = true
	myPart.BrickColor = BrickColor.new("Light pink")
	myPart.Transparency = 0.5
	myPart.Name = name
	myPart.Parent = game.Workspace -- more efficient this way
end

generatePart("Test1", (1, 0, 25, 0))
generatePart("Test2", (2, 0, 35, 0))
generatePart("Test3", (3, 0, 45, 0))
generatePart("Test4", (4, 0, 55, 0))

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