This localscript animation/weld works when i equip the gun then i walk and it is doesn't work when i walk then equip the gun. Why?
gun = script.Parent
Player = game.Players.LocalPlayer
la = Player.Character:FindFirstChild("Left Arm")
t = Player.Character:FindFirstChild("Torso")
rs = Player.Character.Torso:FindFirstChild("Right Shoulder")
ls = Player.Character.Torso:FindFirstChild("Left Shoulder")
local function weldBetween(a, b)
local weld = Instance.new("Weld")
weld.Part0 = a
weld.Part1 = b
weld.C0 = CFrame.new()
weld.C1 = b.CFrame:inverse() * a.CFrame
weld.Parent = a
return weld;
end
function localequipped()
weldBetween(la, gun.Handle)
rs.C0 = rs.C0 *CFrame.new(0.5,1,0)
ls.C0 = ls.C0 *CFrame.new(0,5,4.75)
end
gun.Equipped:connect(localequipped)
function localunequipped()
laweld = la:FindFirstChild("Weld")
laweld:Destroy()
rs.C0 = rs.C0 *CFrame.new(-0.5,-1,0)
ls.C0 = ls.C0 *CFrame.new(0,-5,-4.75)
end
gun.Unequipped:connect(localunequipped)
