Okay, so I've been scripting a basic script that sets properties of objects. I feel like there is an easier method of moving a model rather than moving each separate child of the model. Is there a way to do that? Writing scripts the way I do (as shown below) is taking an ample amount of time.
left = script.Parent.Left right = script.Parent.Right i = math.random(1,4) print(i) if i<=2 then leftClone = left:Clone() leftClone.Name = "leftClone" leftClone.Parent = game.Workspace.Obstacle_1 print("Left is cloned!") print(leftClone.Parent) wait() leftClone.Part1.Anchored = true leftClone.Part2.Anchored = true leftClone.Wedge1.Anchored = true leftClone.Part1.Position = Vector3.new(-7.5, 27.93, -122.605) leftClone.Part2.Position = Vector3.new(-6.202, 52.194, -117.334) leftClone.Wedge1.Position = Vector3.new(-4.659, 52.211, -115.835) leftClone.Part1.Orientation = Vector3.new(10, 0, 90) leftClone.Part2.Orientation = Vector3.new(90, -45, 0) leftClone.Wedge1.Orientation = Vector3.new(0, -125, 0) wait() leftClone.Part1.Transparency = 0 leftClone.Part2.Transparency = 0 leftClone.Wedge1.Transparency = 0 leftClone.Part1.CanCollide = true leftClone.Part2.CanCollide = true leftClone.Wedge1.CanCollide = true print("Left is visible!") wait() leftClone.Part1.onTouch_Death.Disabled = false leftClone.Part2.onTouch_Death.Disabled = false leftClone.Wedge1.onTouch_Death.Disabled = false elseif i>=3 then rightClone = right:Clone() rightClone.Name = "rightClone" rightClone.Parent = game.Workspace.Obstacle_1 print("Right is cloned!") print(rightClone.Parent) wait() rightClone.Part1.Anchored = true rightClone.Part2.Anchored = true rightClone.Wedge1.Anchored = true rightClone.Part1.Position = Vector3.new(-0.53, 27.924, -122.765) rightClone.Part2.Position = Vector3.new(-1.722, 52.187, -117.204) rightClone.Wedge1.Position = Vector3.new(-3.269, 52.205, -115.755) rightClone.Part1.Orientation = Vector3.new(10, 0, 90) rightClone.Part2.Orientation = Vector3.new(90, 45, 0) rightClone.Wedge1.Orientation = Vector3.new(0, 125, 0) wait() rightClone.Part1.Transparency = 0 rightClone.Part2.Transparency = 0 rightClone.Wedge1.Transparency = 0 rightClone.Part1.CanCollide = true rightClone.Part2.CanCollide = true rightClone.Wedge1.CanCollide = true print("Right is visible!") wait() rightClone.Part1.onTouch_Death.Disabled = false rightClone.Part2.onTouch_Death.Disabled = false rightClone.Wedge1.onTouch_Death.Disabled = false end
There is a function called :SetPrimaryPartCFrame(), this will do what you want to do, but it is also known to be inaccurate when done many times, you can still use it though. Before you use this function, you will need to set a primarypart. PrimaryPart is a property of a model and has to be a child of the model in order to be set. When it is set, just use the :SetPrimaryPartCFrame() method and in the parenthesis, just put the CFrame you want to move the model to. The model is moved based on the PrimaryPart's position.