So here is the script:
local animation = Instance.new("Animation") animation.AnimationId = "https://www.roblox.com/Asset?ID=1438749801" local trackanimation = nil local playability = true function playAnimation(AnimationSource) if playability == true then local plr = game.Players.LocalPlayer trackanimation = plr.Character.Humanoid:LoadAnimation(animation) trackanimation.KeyframeReached:connect(function() print ('Working') end) trackanimation:Play() end end local Player = game.Players.LocalPlayer local Mouse = Player:GetMouse() local waituntilback = script.Parent.Parent.Tool.Equipped:connect() script.Parent.Parent.Tool.Equipped:connect(function() if not script.Parent.Parent.Tool.Equipped:connect() then playAnimation(waituntilback) else playAnimation() end end)
But how do I make it where it shows up in the game and How do I make it where it's only a Mouse click. This script only when you pull out the tool it starts the animation.
-- make sure the change the animationId value in the tool! wait(0.5) local Tool = script.Parent local AnimationId = Tool.AnimationId.Value local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Humanoid = Character:WaitForChild("Humanoid") local Cooldown = false local Animation = Instance.new("Animation") Animation.AnimationId = "rbxassetid://"..AnimationId Animation.Parent = Humanoid Tool.Activated:Connect(function() local Anim = Humanoid:LoadAnimation(Animation) Anim:Play() end) -- put a IntValue in the tool and name it AnimationId then just paste the id of the animation you want in the IntValue number label.