Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago

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.

Ad

Answer this question