How do I make a prismatic constraint between to parts with a script?

I have two parts and I know their positions and orientations. How do I create a prismatic between them like the second part is partway through a zipline which connects the two parts? (code below)

local newAttachment0 = Instance.new(“Attachment”, child)
newAttachment0.CFrame = CFrame.new(newAttachment0.Position, sP.Spinner.Position)
local newAttachment1 = Instance.new(“Attachment”, sP.Spinner)
newAttachment1.CFrame = CFrame.new(newAttachment1.Position, child.Position)
local newPrismatic = Instance.new(‘PrismaticConstraint’, child)
newPrismatic.Attachment0 = newAttachment0
newPrismatic.Attachment1 = newAttachment1
newPrismatic.LimitsEnabled = true
newPrismatic.UpperLimit = 80

Edit right now its swing aroundwhen it should just stay in place because it should already be on the line because the attachments are facing eachother.