I couldn’t find any clear instructions on how I would turn this into an actual functioning tool. I’ve tried exporting the animation and tried to run it on a tool but what I tried did not work. Does anyone know how to do this properly?
However if you don’t want to read through it, here is just a basic run down.
In order to run an animation when you click with the tool equipped, you have to detect that click. There are other ways to detect a click, but we’re going to use UIS:
local UIS = game:GetService("UserInputService")
local Players = game.Players
UIS.InputBegan:Connect(function(input, event)
if input.UserInputType == Enum.UserInputType.MouseButton1 and script.Parent.Equipped then
local animation = Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
animation:Play() --Because the animation is non-looping, it'll stop itself
end
end)
Also, you will need an Animation instance in order for it to run. You can either just insert one into the model or anywhere you want (and replace script.Parent.Animation to wherever), or you can just do Instance.new(), up to you. Anyways I hope that helps! Read the other post if you want more info on it!
Minor thing, but I would suggest bumping the arm up instead of the gun. It might turn out to be a bit easier to do as well. Other than that, the post above mine appears to be correct.