Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.