I'm making a FPS gun, I made the arm and gun, they worked. but arms animation doesn't work. this is the script about arms animation. this is a LocalScript in my gun tool.
wait(.5) local tool = script.Parent local cam = workspace.CurrentCamera local gun = game.ReplicatedStorage:FindFirstChild("K2Rifle") local fps_hold = gun.Humanoid:LoadAnimation(gun.Hold) --animation load holding = false --when i hold a gun, it'll be true for i,v in pairs(gun:GetChildren()) do if v:IsA("BasePart") then if v ~= gun.PrimaryPart then local weld = Instance.new("Weld") weld.Part0 = gun.PrimaryPart weld.Part1 = v weld.C0 = gun.PrimaryPart.CFrame:inverse() weld.C1 = v.CFrame:inverse() weld.Name = v.Name weld.Parent = gun.PrimaryPart end end end run.RenderStepped:connect(function() if holding == true then gun:SetPrimaryPartCFrame(gun:GetPrimaryPartCFrame():lerp(cam.CFrame*CFrame.new(0,-2,.2),.3)) end end) tool.Equipped:connect(function() for i ,v in pairs(tool:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 1 end end holding = true gun.Parent = cam fps_hold:Play() end) --when i hold a gun, arms will show up on the screen.then animation should play. tool.Unequipped:connect(function() gun.Parent = game.ReplicatedStorage holding = false fps_hold:Stop() end)
i tried with this script. but the animation doesn't work :(