Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

** 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

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

1 comment

0

I also forgot to mention that the massless option is very useful in properties

This discussion is preserved as it was. New answers, comments, and votes are closed.