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

The weld object doesn't do it's job, any solutions?

Asked by
Echtic 128
5 years ago

Here's the script:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
    local h1 = game.ReplicatedStorage.Hairs.h1:Clone()
    h1.Name = "h1"
    h1.Parent = player.Character.Head

    local weld = Instance.new("Weld")
    weld.Parent = h1
    weld.Part0 = player.Character.Head
    weld.Part1 = h1
    weld.C0 = CFrame.new(0,0,0)

end)

So the h1 parent is alright, weld parent is also alright, weld part0 and part1 are alright too but the actual welding doesn't happen, the part just doesn't get attached to the head.Any solutions?

1 answer

Log in to vote
0
Answered by
thebayou 441 Moderation Voter
5 years ago

You need to set the weld's C1 to:

weld.C1 = h1.CFrame:toObjectSpace(player.Character.Head.CFrame);

Also, more of a suggestion, but I recommend you try out WeldConstraints. It's basically just a normal weld, except all the annoying c0 and c1 crap is handled for you.

Ad

Answer this question