Any help with this weld?

So I have this script that would weld this union to the player, but it does not weld and just falls threw the world, any help?

script.Parent.MouseButton1Click:Connect(function()
	local player = script.Parent.Parent.Parent.Parent
	local character = player.Character
			if character:FindFirstChild("Humanoid") ~= nil then -- Accessory script
				local p = script:WaitForChild("Union"):Clone()
				p.Parent = character
				p.Name = "Toothbrush"
				p.Transparency = 0.5
				p.Position = character:FindFirstChild("LeftHand").Position
				local dog = Instance.new("WeldConstraint")
				dog.Part0 = p
				dog.Part1 = character.LeftHand
				print("It should work")
				wait(.1)
			end
		end)
1 Like

Along with Part1 and Part0, a Weld will also have the properties of C0 and C1 to secure them well. This DevHub article can help a bit.

1 Like

This is a weld constraint tho??

1 Like

I got the script working, I forgot to make the weld parent on the union, but this is my new problem, when moving it changes the new positions?

I might wanna make it more clear then. For example, say “WeldConstraint” in the title, rather than “Weld”.

I’m a bit confused by the picture. Did you click the button multiple times to get that much toothbrushes? My suggestion if they keep spawning different places is before you add the WeldConstraint, specify not only the position, but the rotation of it. For example:

script.Parent.MouseButton1Click:Connect(function()
	local player = script.Parent.Parent.Parent.Parent
	local character = player.Character
			if character:FindFirstChild("Humanoid") ~= nil then -- Accessory script
				local p = script:WaitForChild("Union"):Clone()
				p.Parent = character
				p.Name = "Toothbrush"
				p.Transparency = 0.5
				p.CFrame= CFrame.new(character:FindFirstChild("LeftHand").Position) * CFrame.Angles(0,0,0) -- Change to your wanted angles.
				local dog = Instance.new("WeldConstraint")
				dog.Part0 = p
				dog.Part1 = character.LeftHand
				print("It should work")
				wait(.1)
			end
		end)

I switched out position with CFrame so you can also have control over the rotation, which is the likely factor of the toothbrush issue.

Right as you made this post, I had already swithced the position to cframe. this is my results.

script.Parent.MouseButton1Click:Connect(function()
	local player = script.Parent.Parent.Parent.Parent
	local character = player.Character
				local p = script:WaitForChild("Union"):Clone()
				p.Parent = character
				p.Name = "Toothbrush"
				p.CFrame = character:FindFirstChild("LeftHand").CFrame 
				local dog = Instance.new("WeldConstraint")
				dog.Parent = p
				dog.Part0 = p
				dog.Part1 = character.LeftHand
				print("It should work")
				wait(.1)
			end)
1 Like

I’d do the way I did mine, as by taking the CFrame like that, it not only takes the hand’s position, but it’s rotation (which could be different from the toothbrush, leaving it possibly sideways, upside-down, etc.)

1 Like