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

How do I make the part stay behind the player?

Asked by
tumadrina 179
10 years ago
game.Players.PlayerAdded:connect(function(Plr)
    Plr.CharacterAdded:connect(function(Char)
        local BackPack=Instance.new("Part",workspace)
        while wait() do
        BackPack.Position=Char.Torso.Position+Vector3.new(0,0,-2)
        end
    end)
end)

this keeps the Part but when he turns it doesn't turn with him, do I need a tool?

1 answer

Log in to vote
1
Answered by 10 years ago

Just weld the Backpack to the player's torso, like this:

game.Players.PlayerAdded:connect(function(Plr)
    Plr.CharacterAdded:connect(function(Char)
        local BackPack=Instance.new("Part",workspace)
        local Weld = Instance.new("Weld",BackPack)
        Weld.Part0 = BackPack
        Weld.Part1 = Char.Torso
        Weld.C0 = CFrame.new() --Put the CFrame of the Backpack here
    end)
end)
0
Thank you tumadrina 179 — 10y
Ad

Answer this question