Ad
Log in to vote
0

how do i make a weld follow the players movement?

Asked by
pr3cure -26
15 days ago

I am trying to make a katana weld at the players lower torso, which i have done already, however when the player is walking or jumping it stays in a stiff position. How would i write a script that makes it follow what the player does? my script:

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        local katana = script.Katana:Clone()
        katana:SetPrimaryPartCFrame(Character.LowerTorso.CFrame)
        katana.Parent = Character

        local weld = Instance.new("ManualWeld")
        weld.Part0 = katana.PrimaryPart
        weld.Part1 = Character.PrimaryPart
        weld.C0 = weld.Part0.CFrame:ToObjectSpace(weld.Part1.CFrame)
        weld.Parent = weld.Part0
    end)
end)

1 answer

Log in to vote
0
Answered by 14 days ago

to get the katana to move relative to what you've connected it to you're gonna have to use a Motor6D, not a weld. from there you can use the inbuilt roblox animation editor to animate its movement.

Ad

Answer this question