Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why won't this animation/weld localscript work?[UNSOLVED]

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)

1 answer

This is just my suggestion, but maybe when your moving the Animations of the arms brakes the cframe, and The script cant seem to figure out how to load the animation when the Character animation happens like you said walking.

This discussion is preserved as it was. New answers, comments, and votes are closed.