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

Character not moving when attached to a rope constraint?

Asked by 4 years ago

I am trying to make a type of grapple hook thing I guess, and I have some ideas on how to improve it but, it works except for the rope constraint is off and the character doesn't move.

local player = game.Players.LocalPlayer
local character = player.Character
local Mouse = player:GetMouse()
local Ui = game:GetService("UserInputService")
local humanoid = character.Humanoid

Ui.InputBegan:Connect(function(key)
    if key.UserInputType == Enum.UserInputType.MouseButton1 then
        local ropeCon = Instance.new("RopeConstraint")
        local attach1 = Instance.new("Attachment")
        local attach2 = Instance.new("Attachment")
        local charparts = character:GetChildren()
        attach1.Parent = character:FindFirstChild("RightHand")
        attach1.Position = character:FindFirstChild("RightHand").Position
        attach2.Parent = Mouse.Target
        attach2.Position = Mouse.Target.Position
        wait(.1)
        ropeCon.Attachment0 = attach1
        ropeCon.Attachment1 = attach2
        ropeCon.Parent = character:FindFirstChild("RightHand")
        ropeCon.Visible = true
        ropeCon.Restitution = 0
        print(Mouse.Target.Name)
    end
end)

The script is a local script inside of StarterCharacterScripts

Answer this question