WeldConstraint Disappearing From Character on Spawn

My goal is to have a WeldConstraint put in the player’s right hand for a tool system I’m working on, and the code should work in theory. For whatever reason, the code runs perfectly, and then the WeldConstraint just deletes itself for no reason. My code is in a ServerScript, and here it is:


local toolTracker = {}

Players.PlayerAdded:Connect(function(player)
	toolTracker[player.Name] = {holdingTool = false, tool = nil}
	player.CharacterAdded:Connect(function(character)
		local weld1 = Instance.new("WeldConstraint")
		weld1.Parent = character.RightHand
		weld1.Name = "Weld1"
		weld1.Part0 = character.RightHand
	end)
end)

I must be forgetting something about how CharacterAdded works because I swear that it’s safe to insert things into a player after their character loads. I don’t understand why the weld keeps deleting itself. I know it deletes itself after it’s added because I used the Instance.Destroyed event, and it fires after the weld is created.

2 Likes

(Sorry for reviving the thread)
Adding a task.wait() seems to have fixed it entirely.
I guess adding things to a character right as the character is added just doesn’t work

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.