I am making a gun and basically when I equip the tool it doesn't play the holding animation. when I unequip the gun, all the functions from the gun still work, for example, the aiming. function. Here is the script:
--Variables local cam = game.Workspace.CurrentCamera local mouse = game.Players.LocalPlayer:GetMouse() local ts = game:GetService("TweenService") --animations local equipanim = script:WaitForChild("equip") local equiptrack = game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):LoadAnimation(equipanim) local aimanim = script:WaitForChild("aim") local aimtrack = game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):LoadAnimation(aimanim) --events script.Parent.Equipped:Connect(function() equiptrack:Play() mouse.Button2Down:Connect(function() equiptrack:Stop() game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = 10 mouse.Icon = "http://www.roblox.com/asset?id=1871997087" local ti = TweenInfo.new(.1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out) local tablething = { FieldOfView = 40 } local tween = ts:Create(cam,ti,tablething) tween:Play() aimtrack:Play() end) mouse.Button2Up:Connect(function() aimtrack:Stop() equiptrack:Play() game.Players.LocalPlayer.Character:WaitForChild("Humanoid").WalkSpeed = 16 mouse.Icon = "" local ti = TweenInfo.new(.1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out) local tablething = { FieldOfView = 70 } local tween = ts:Create(cam,ti,tablething) tween:Play() end) end) script.Parent.Unequipped:Connect(function() equiptrack:Stop() aimtrack:Stop() end)