Weld doesn't set part1 to desired position despite script instructions

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		
		local RightHand = Character:WaitForChild("RightHand")
		
		local Folder = Instance.new("Folder",Character)
		Folder.Name = Player.Name.."'s Mjolnir"
		
		local Mjolnir = WeaponFolder:WaitForChild("Mjolnir"):Clone()
		Mjolnir.CFrame = RightHand.CFrame
		Mjolnir.Parent = Folder 
		
		local Weld = Instance.new("Weld")
		Weld.Part0 = Mjolnir
		Weld.Part1 = RightHand
		Weld.C0 = Weld.Part0.CFrame:ToObjectSpace(Weld.Part1.CFrame)
		Weld.Parent = Weld.Part0
		
	end)
end)

As you can see above I had every part designated to the right place, the part that I want to weld goes to part0 and the part I’m welding to goes to part1. However when I run the script and look at the weld’s properties under mjolnir in the explorer. Its part1 slot is empty, resulting in a broken weld, what’s the cause behind this? How do i fix it?

1 Like

Could you try adding print() statements or change the Part1 again after a certain interval of time has passed?

1 Like

What exactly do you mean? change the part one to the same part again?

1 Like

i think your parenting the weld on the Part0

I should be parenting it to part1 then?

parent the weld somewhere like a folder

Can i parent it to the weapon itself?

The parent doesn’t matter. I would say put Part0 as the more dominant part, in this case RightHand, but I’m not sure if that will fix anything.

try to see if it works 30 letters

@myaltaccountsthis was right, the parenting didn’t change anything. the issue i found is that this line

doesn’t actually set part1 to my right hand and i have to manually do it myself in order for it to work which weird. This a studio bug?

try using WeldConstraint instead of Weld then CFrame your tool handle on RightHand

I’m not using a tool, just want to weld the damn part to my hand.

then weld the part and cframe it on ur hand

I did that in my code didn’t I?

i think this is the problem, you didnt set the Weld.C1 (i guess)

After a couple of seconds have passed inside that event, change the Weld.Part1 again or the Weld.C1