#[SOLVED] How do i weld the player to another players back?

1 messages · Page 1 of 1 (latest)

wise gale
#

I'm working on a carrying system but the welding part is not working.

#
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local carryRequest = ReplicatedStorage:FindFirstChild("Events"):FindFirstChild("Carry"):FindFirstChild("CarryRequest")
local carryPrompt = ReplicatedStorage:FindFirstChild("Events"):FindFirstChild("Carry"):FindFirstChild("CarryPrompt")
local carryAccepted = ReplicatedStorage:FindFirstChild("Events"):FindFirstChild("Carry"):FindFirstChild("CarryAccepted")


carryAccepted.OnServerEvent:Connect(function(targetPlayer, requester)
    if not requester or not targetPlayer then return end

    local requesterChar = requester.Character
    local targetChar = targetPlayer.Character

    if requesterChar and targetChar and
        requesterChar:FindFirstChild("HumanoidRootPart") and
        targetChar:FindFirstChild("HumanoidRootPart") then

        local requesterHRP = requesterChar.HumanoidRootPart
        local targetHRP = targetChar.HumanoidRootPart

        local offset = CFrame.new(0, 0, 2) * CFrame.Angles(0, math.rad(180), 0)
        targetChar:PivotTo(requesterHRP.CFrame * offset)

        local weld = Instance.new("Weld")
        weld.Part0 = requesterHRP
        weld.Part1 = targetHRP
        weld.C0 = offset
        weld.Parent = requesterHRP

        local hum = targetChar:FindFirstChildOfClass("Humanoid")
        if hum then
            hum.PlatformStand = true
        end

        -- add anim
    end
end)

#

I want to make it so the person who accepted gets welded to the other players back and faces the other way but they just get put on the floor

tropic zodiac
#
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local carryRequest = ReplicatedStorage:FindFirstChild("Events"):FindFirstChild("Carry"):FindFirstChild("CarryRequest")
local carryPrompt = ReplicatedStorage:FindFirstChild("Events"):FindFirstChild("Carry"):FindFirstChild("CarryPrompt")
local carryAccepted = ReplicatedStorage:FindFirstChild("Events"):FindFirstChild("Carry"):FindFirstChild("CarryAccepted")

carryAccepted.OnServerEvent:Connect(function(targetPlayer, requester)
    if not requester or not targetPlayer then return end

    local requesterChar = requester.Character
    local targetChar = targetPlayer.Character

    if requesterChar and targetChar then
        local requesterHRP = requesterChar:FindFirstChild("HumanoidRootPart")
        local targetHRP = targetChar:FindFirstChild("HumanoidRootPart")
        if not requesterHRP or not targetHRP then return end

        for _, part in ipairs(targetChar:GetDescendants()) do
            if part:IsA("BasePart") then
                part.CanCollide = false
            end
        end

        local offset = CFrame.new(0, 0, -2) * CFrame.Angles(0, math.rad(180), 0)
        targetChar:PivotTo(requesterHRP.CFrame * offset)

        local motor = Instance.new("Motor6D")
        motor.Name = "CarryAttachment"
        motor.Part0 = requesterHRP
        motor.Part1 = targetHRP
        motor.C0 = offset
        motor.C1 = CFrame.new()
        motor.Parent = requesterHRP

        local hum = targetChar:FindFirstChildOfClass("Humanoid")
        if hum then
            hum.PlatformStand = true
        end
    end
end)