Is it possible to make a grapple hook with a Rope Constraint?

I’ve been trying for a couple hours to make a grapple hook made from a Rope Constraint. I’ve got a working system for clicking walls and attaching a Rope Constraint, but whenever I test this out the player is frozen when connected to the rope.
I’ve messed around and found that if a Rope Constraint is connected to both a player and a anchored part, the player gets frozen like it is anchored.
Is there any way around this? I’ve tried adding attachments to multiple parts on the player and tried welding part that is attached to the rope onto the player, but none of this worked as long as the player is attached to the Rope Constraint.

Also, Is this a bug or is it intended to function this way?

1 Like

You’re seeing the result of the Humanoid’s internal forces acting upon the player. You can stop the Humanoid from applying a downward force by setting their state to Physics or making them PlatformStand, though they will also lose regular mobility which you will need to account for.

In any case: seeing your exact setup and the behaviours you’re running into in the form of a video would be helpful to attempt to replicate your environment and do some tests based off of that. Without any of that, it’s difficult to actually give you any insight to how you could fix this.

3 Likes

This is quite messy, but I got it to work.

I made an unanchored ball that is attached to the anchored block I created via another RopeConstraint and connected the player to that instead. That way the player is connected to an unachored part instead of an anchored part and can move, and the unachored part stays in place like it is actually anchored.
I edited the CustomPhysicalProperties of the ball to make it’s Density 100, because without that it would bug out.

Here’s the mess of code I put together:

repeat wait() until game.Players.LocalPlayer
local player = script.Parent.Parent
local mouse = player:GetMouse()

local function onMouseClick()
		if mouse.Target then
		if script.Value.Value == false then --Check if Rope is already out of not
		script.Value.Value = true
			local brick = Instance.new("Part") --Creates the part where the Attachment will be held
			brick.Size = Vector3.new(0.05,0.05,0.05)
			brick.Parent = game.Workspace
			brick.Transparency = 1
			brick.CanCollide = false
			brick.Anchored = true
			brick.Position = mouse.Hit.p --Brick positioned on click
			brick.Name = "attb"
			local UA = Instance.new("Part")
			UA.Size = Vector3.new(0.5,0.5,0.5) --Creates the Unanchored part that is attached to the other brick
			UA.CustomPhysicalProperties = PhysicalProperties.new(100,0,0,0,0) --Make it the heaviest it can be to stop it from bugging out
			UA.Parent = brick
			UA.Shape = "Ball"
			UA.Transparency = 1
			UA.CanCollide = false
			UA.Anchored = false
			UA.Position = brick.Position --Put it inside the brick
			local UAatt = Instance.new("Attachment") --Attachment the goes inside the ball
			UAatt.Parent = UA
			UAatt.WorldPosition = UA.Position
			local Brickatt = Instance.new("Attachment") --Attachment that goes inside the brick
			Brickatt.Parent = brick
			Brickatt.WorldPosition = brick.Position
			local BrUARope = Instance.new("RopeConstraint") --Creates a rope between the anchored brick and the unachored ball it in place
			BrUARope.Parent = brick
			BrUARope.Attachment0 = Brickatt
			BrUARope.Attachment1 = UAatt
			BrUARope.Length = 0.1
			BrUARope.Thickness = 1
			local rope1 = Instance.new("RopeConstraint") --Creates the Rope that is attached between the ball and the player
			rope1.Attachment0 = player.Character.Torso.BodyBackAttachment
			rope1.Attachment1 = UAatt
			rope1.Thickness = 0.2
			rope1.Parent = UA
			rope1.Name = "Rope"
			rope1.Length = player:DistanceFromCharacter(brick.Position) +1 --Calculates Rope Length
			rope1.Visible = true
		else
			local ropedelete = game.Workspace:FindFirstChild("attb") --Deletes everything
			ropedelete:Destroy()
			script.Value.Value = false
		end
		end
	end

mouse.Button1Down:Connect(onMouseClick)

--If the player is attached to an achored part, the player gets frozen like it was anchored aswell. 
--Attaching the player to an unanchored part however makes it work as it should.
--The two parts are needed to hold the unachored part in place so it acts anchored when it isn't.
--Doing this allows the player to move while attached to the wall.

8 Likes