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

Grabbing objects by using welds?[Solved]

Asked by
St_vnC 330 Moderation Voter
4 years ago
Edited 4 years ago

So I suck at math lmao or my knowledge of the roblox API is not large enough. I would like to know to grab item with a certain keybind. Here's what I came up with :

Character.GrabRightArm.Touched:Connect(function(hit)
    if hit and RG == true then
    -- Checks for Welds
        local Weld = Character.GrabRightArm:FindFirstChild("Weld")
        if Weld and Weld.Part1 ~= hit then
            Weld:Destroy()
            local Weld = Instance.new("Weld", Character.GrabRightArm)
            Weld.Part0 = Weld.Parent
            Weld.Part1 = hit
            Weld.C0 = Weld.Part0.CFrame
            Weld.C1 = Weld.Part1.CFrame
            hit.Massless = true
        elseif Weld == nil then
            local Weld = Instance.new("Weld", Character.GrabRightArm)
            Weld.Part0 = Weld.Parent
            Weld.Part1 = hit
            Weld.C0 = Weld.Part0.CFrame
            Weld.C1 = Weld.Part1.CFrame
            hit.Massless = true
        end
    end
end)

This is the only part required because it's where the weld is being made.

1
i wanna know this too but i suck also so can someone tell me when this is answered speedyfox66 237 — 4y
0
Hey, if you have solved this question, then please post the answer, that way you can help others with this problem too Lord_WitherAlt 206 — 4y

Answer this question