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 =“Attachment”, child)
newAttachment0.CFrame =, sP.Spinner.Position)
local newAttachment1 =“Attachment”, sP.Spinner)
newAttachment1.CFrame =, child.Position)
local newPrismatic =‘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.