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

Model doesn't weld to anything but humanoid root part in script. Why?

Asked by 2 years ago

I am trying to weld a backpack to the characters upper torso so it can move along with the rest of the body. The only problem is every time I try to do that, the backpack spawns unwelded, about 30 studs away from my characters back. When I weld it to HumanoidRootPart, it welds, and it is in the middle of my character, but does not follow animations.

game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(char)

            local torso = char:WaitForChild("HumanoidRootPart")
            local uppertorso = char:WaitForChild("UpperTorso")--You can change this to another body part
            game:WaitForChild("ReplicatedStorage")
            local backpack = game.ReplicatedStorage.backpack:Clone()
            backpack.Parent = char

            local weld = Instance.new("Motor6D", uppertorso) --Could also use a Motor6D, or likewise
            weld.C0 = CFrame.new() --Both C0 and C1 are, by default, set to a blank CFrame
            weld.C1 = CFrame.new()
        weld.Enabled = true
        weld.Part0 = backpack.PrimaryPart


        weld.Part1 = uppertorso
            player:WaitForChild("leaderstats")
            backpack.textpart.SurfaceGui.TextLabel.Text = "DNA: "..tostring(player.leaderstats.DNA.Value)
        end)

        end)

0
Is your character r6 or r15? Kingu_Criminal 205 — 2y
0
r15 Stiles8353 35 — 2y

Answer this question