Handcuff-Script not welding

Hello! I tried to make something like this without the billboard gui’s but for some reason mine doesn’t weld it like this one. https://gyazo.com/34dcd9f559c35925297ee505f9848418
I want a detain handcuff script. For me, it looks like this:

My script:

--//local script//--
local Cuff = script.Parent
local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait()
local Handle = Cuff.Handle
local mouse = plr:GetMouse()
local isEquipped = false
local MyHumanoidRootPart = char:FindFirstChild("HumanoidRootPart")
local MyHumanoid = char:FindFirstChild("Humanoid")
local Range = 200


Cuff.Equipped:Connect(function()
    isEquipped = true
end)

Cuff.Unequipped:Connect(function()
    isEquipped = false
end)


mouse.Button1Down:Connect(function()
    if isEquipped then
        local ray = Ray.new(Handle.CFrame.p, (mouse.Hit.p - Handle.CFrame.p).unit * Range)
        local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)
        
        if part.Parent:FindFirstChild("Humanoid") or part.Parent.Parent:FindFirstChild("Humanoid") then
            
        local TargetHumanoid = part.Parent:FindFirstChild("Humanoid") or part.Parent.Parent:FindFirstChild("Humanoid")
        local TargetHumanoidRootPart = TargetHumanoid.Parent:FindFirstChild("HumanoidRootPart")
            game.ReplicatedStorage.Cuff:FireServer(TargetHumanoid, TargetHumanoidRootPart)
            
        end
    end
end)



--//server script//--
local RS = game:GetService("ReplicatedStorage")

local CuffEvent = RS:FindFirstChild("Cuff")

CuffEvent.OnServerEvent:Connect(function(plr, TargetHumanoid, TargetHumanoidRootPart)
    TargetHumanoidRootPart.CFrame = plr.Character:FindFirstChild("HumanoidRootPart").CFrame + CFrame.new(10, 0, 0)
    local weld = Instance.new("Weld")
    weld.Part0 = plr.Character:FindFirstChild("HumanoidRootPart")
    weld.Part1 = TargetHumanoidRootPart
    weld.C0 = plr.Character:FindFirstChild("HumanoidRootPart").CFrame:Inverse()
    weld.C1 = TargetHumanoidRootPart
    weld.Parent = game.Workspace

end)

Youre just adding an offset of 10, you need to multiply.
TargetHumanoidRootPart.CFrame = plr.Character:FindFirstChild("HumanoidRootPart").CFrame * CFrame.new(0, 0, -10)

1 Like

It works better now, thank you but it’s still not really welding, it’s just teleporting the player in front of the cuffer.

Try this

TargetHumanoidRootPart.CFrame = plr.Character:FindFirstChild("HumanoidRootPart").CFrame + CFrame.new(10, 0, 0)
    local weld = Instance.new("WeldConstraint")
    weld.Part0 = plr.Character:FindFirstChild("HumanoidRootPart")
    weld.Part1 = TargetHumanoidRootPart
    weld.Parent = TargetHumanoidRootPart
1 Like

It’s not even teleporting the player infront of the cuffer, now.

i accidentally edited the wrong code

TargetHumanoidRootPart.CFrame = plr.Character:FindFirstChild("HumanoidRootPart").CFrame * CFrame.new(0, 0, -10)
    local weld = Instance.new("WeldConstraint")
    weld.Part0 = plr.Character:FindFirstChild("HumanoidRootPart")
    weld.Part1 = TargetHumanoidRootPart
    weld.Parent = TargetHumanoidRootPart
1 Like

It’s working now but I think I have to give the cuffer the networkownership or something like that to make it work properly.

You should make the handcuffed character un-collideable and weightless. And you might want to weld the player locally as well.

1 Like

It works! I made an in pairs loop that disables the CanCollide of the Target’s BodyParts. It looks like this now! Thank you!!

2 Likes