I was writing a code for a grappling hook and almost finished, just a couple of errors being idk how to make brick distance stuff. Help please! The grapple bricks are bricks above the buildings.
uis = game:GetService('UserInputService')
local player = game.Players.LocalPlayer
PartA = game.Workspace.PartA
function Grapple(partA, partB)
local attachmentA = Instance.new("Attachment", partA)
local attachmentB = Instance.new("Attachment", partB)
local rodConstraint = Instance.new("RodConstraint", partA)
rodConstraint.Attachment0 = attachmentA
rodConstraint.Attachment1 = attachmentB
rodConstraint.Length = (partA.Position - partB.Position).magnitude
return rodConstraint
end
uis.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.F then
local constraint = Grapple(PartA,player.Character.HumanoidRootPart)
end
end)

1 comment
Please provide more details and context. What do you mean by grappled? What isn't working? What are the errors? What happens when you run the script?