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

Vector3 only works with numbers and not with brick.Position?

script.Parent.Touched:Connect(function()
	print(workspace.lol.Position)
	Brick = game.ServerStorage.Part:Clone()
	Brick.Parent = workspace
	wait()
	Brick.Position = Vector3.new(workspace.part2.Position)
end)

The position part only works if I put the numbers, but when I put the brick's position like in the script above, the bricks spawn in the middle of the baseplate instead.

1 comment

0

Just do Brick.Position = workspace.part2.Position

1 answer

✓ Accepted answer

That's because you're using the position inside of a Vector3 constructor.

If you're saying Vector3.new(), it expects you to input regular number values and returns a Vector3 value as a result. The position of a part is already a Vector3 value, so putting it into a constructor won't work. However, there's no need for a constructor because the Vector3 data is already created. Therefore, you should instead set the Brick.Position simply to workspace.part2.Position.

local part2 = workspace:WaitForChild("part2") -- use variables!

-- other code
Brick.Position = part2.Position

Hope this helps! :)

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