I have a sword and when you press a key it switches into a gun then after a delay back into a sword. Everything is fine in Studio, of course...but in the game when it's switching from sword to gun the weld/position become weird. Then sword will still be equipped to the player but it will be floating off somewhere instead of in the player's hand. I created a script to for the weld to fix itself but that hasn't seemed to work.
local Player = game.Players.LocalPlayer
char = Player.Character
while wait() do
local w1 = Instance.new("Weld", char)
w1.Part0 = char["Right Arm"]
w1.Part1 = script.Parent.Handle
w1.C1 = CFrame.fromEulerAnglesXYZ(math.rad(90),0,0) *CFrame.new(0, 1.1, 0)
--Forcing the sword to stay welded in the players hand
end

3 comments
Glad you figured it out. It'd be good if you edited the title of this question to have "[Solved]" in the title so others won't read your question unnecessarily.
Will do
I'm having the same problem, but my sword has a lot of parts, and won't stay connected to the character no matter what