Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

[SOLVED] How could you get a constraint to pull the player to a part/destination not vise versa?

Asked by 6 years ago
Edited 6 years ago

** Basically I made a system that wherever you click on the map a part would change it's CFrame to the position of your mouse cursor and connect an attachment to your hand, and an attachement to the part. However, when the part is positioned or teleported to your mouse the constraint ends up pulling the part towards the player, not the other way around. I have tried anchoring the part but that ended up anchoring my character also once the attachments were placed.** ( A good example of what I am trying to simulate is the movement in noodle arm simulator when you click to move your arms. )

The Following is the code I am using to connect the part your hand using attachments


local mouse = game.Players.LocalPlayer:GetMouse() local brick = workspace.Part mouse.TargetFilter = brick mouse.Button1Down:Connect(function() brick.CFrame = CFrame.new(mouse.Hit.p) local partA = game.Players.LocalPlayer.Character.LeftHand local attachmentA = Instance.new("Attachment", partA) attachmentA.Position = Vector3.new(2,2,0) partB = game.Workspace.Part local attachmentB = Instance.new("Attachment", partB) attachmentB.Position = Vector3.new(0,.5,0) local rodConstraint = Instance.new("RopeConstraint",partA) rodConstraint.Attachment0 = attachmentA rodConstraint.Attachment1 = attachmentB rodConstraint.Length = 1 end)

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Nevermind, I thought up a solution with rocketpropulsion and making the character a ragdoll temporarily. It seems to work well! :)

0
I also forgot to mention that the massless option is very useful in properties SILLYBILLY128478 25 — 6y
Ad

Answer this question