How do I make a path continuous

image
How do I make this completely connect with each other?

Code I already have

local Part = game.ReplicatedStorage.Segment:Clone()
Part.Parent = game.Workspace.Segments
Part.Name = "0"
Part:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0,0.5,0)))

local Part = game.ReplicatedStorage.Segment:Clone()
Part.Parent = game.Workspace.Segments
Part.Name = "1"
Part:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0,0.5,75)) * CFrame.Angles(0,math.rad(math.random(-10, 10) + game.Workspace.Segments:FindFirstChild(Part.Name - 1).PrimaryPart.Orientation.Y),0))
Part:SetPrimaryPartCFrame(CFrame.new(Part.PrimaryPart.Position - (Part.PrimaryPart.Back.WorldPosition - game.Workspace.Segments:FindFirstChild(Part.Name - 1).PrimaryPart.Front.WorldPosition)) * CFrame.Angles(0,math.rad(Part.PrimaryPart.Orientation.Y),0))

Figured it out myself

Just added extra attachments for left and right sides

local Part = game.ReplicatedStorage.Segment:Clone()
Part.Parent = game.Workspace.Segments
Part.Name = "1"
Part:SetPrimaryPartCFrame(CFrame.new(Vector3.new(0,0.5,75)) * CFrame.Angles(0,math.rad(math.random(-10, 10) + game.Workspace.Segments:FindFirstChild(Part.Name - 1).PrimaryPart.Orientation.Y),0))

if Part.PrimaryPart.Orientation.Y > 0 then
	
	Part:SetPrimaryPartCFrame(CFrame.new(Part.PrimaryPart.Position - (Part.PrimaryPart.BackR.WorldPosition - game.Workspace.Segments:FindFirstChild(Part.Name - 1).PrimaryPart.FrontR.WorldPosition)) * CFrame.Angles(0,math.rad(Part.PrimaryPart.Orientation.Y),0))	
	
else
	
	Part:SetPrimaryPartCFrame(CFrame.new(Part.PrimaryPart.Position - (Part.PrimaryPart.BackL.WorldPosition - game.Workspace.Segments:FindFirstChild(Part.Name - 1).PrimaryPart.FrontL.WorldPosition)) * CFrame.Angles(0,math.rad(Part.PrimaryPart.Orientation.Y),0))	
	
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.