RopeConstraint help

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I wanted someone to help with me. (Making grab people dead body.)
  2. What is the issue? Include screenshots / videos if possible!
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I didn’t even found single yet.
LOCAL script:
local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()
local UIS = game:GetService("UserInputService")
local playerS = game:GetService("Players")
local distance = 15
local debounce = false
local undrag = game:GetService("ReplicatedStorage"):WaitForChild("UnDragPlayer")
local drag = game:GetService("ReplicatedStorage"):WaitForChild("DragPlayer")

UIS.InputBegan:Connect(function(i, g)
	print("input beganned")
	if g then
		if i.KeyCode == Enum.KeyCode.E and mouse.Target then
			drag:FireServer(Player, mouse.Target.Parent)

Remote Server Script:

dragplayerevent.OnServerEvent:Connect(function(plr, target)
	local ropeC ="RopeConstraint")
	ropeC.Attachment0 = plr.Character:WaitForChild("Right Arm") 
	ropeC.Attachment1 = target:WaitForChild("UpperTorso")

I don’t know how to fix this.

That’s because you’re trying to set a part has an Attachment. You must create an attachment, make the target part its parent and then attach the rope to that attachment

1 Like

I noticed, parameters act weirdly.

RopeConstraint Attachment0 and Attachment1 properties only accepts Attachment class objects. You need to create an attachment object under the parts you want to connect with RopeConstraint then set RopeConstraint Attachment1 and Attachment0 properties to those attachments. The fixed code should look like this:

dragplayerevent.OnServerEvent:Connect(function(plr, target)
    local ropeC ="RopeConstraint")
    ropeC.Attachment0 ="Attachment",plr.Character:WaitForChild("Right Arm")) 
    ropeC.Attachment1 ="Attachment",target:WaitForChild("UpperTorso"))

Also you don’t have to add a player parameter for FireServer function because the game sets that as the first parameter for you, you just have to put the arguments you want into that function.

1 Like

target parameter equal to player name ( which is me) , not a target object.

It work but the parameters was not correctly.

Yes because when you fire the event with FireServer(Player, mouse.Target.Parent) the event will have 3 parameters, not 2 because the function adds the first parameter as LocalPlayer automatically so in order to fix that issue just use FireServer(mouse.Target.Parent) so the target can be the 2nd parameter like it’s supposed to be when you fire the event.

Oooo, I just understand about remote events.

It work, but rope is not visible. :? (it only have attachment not a rope constraint)

I think the RopeConstraint.Parent not being set up?

Oh yeah, you also have to add the line below inside the function so it becomes visible:

ropeC.Visible = true
1 Like