URGENT HELP NEEDED PLEASE HELP! "School project"

its all good guys lol, so with the script you sent through just then that would replace the swing anim that plays? right

in

 animation.Value = "rbxassetid://YOURANIMATIONIDHERE"

Replace “YOURANIMATIONIDHERE” with your animationid.

i know lol iugfguigdfgiugyufryuvyug sorry character limit

its pseudo code, lemme change it a bit for ya

Make it as the solution if it work, also the waitTime one you put how much time it take for the mining value become false and the animation end.

does that still work the same way as the script though, including making the animation provided in the one you sent play as the swing anim??

i didn’t try it but from my scripting knowledge it should work. the animation is the swing anim btw

This is bad practice (sort of). Every time the mine() is called, it will create a new animation. Over time, it will create so many it might lag the game.

Oh, forgot about that, thank you!

ok i will lol character limit
nfdjlcnsdkmcklsdcmsd

can you fix it for me i dont know how i would do it lol

alright, i’ll be right back EE

did u fix it?? i have to go in a bit its my next period

ok, let me know if youve fixed it, it looks like you have but just lemme know anyway, i gtg soz thanks for your help ill be back for more if i need it lol :grinning:

local tool = script.Parent
local anim = tool:WaitForChild("ANIMATION_NAME")
local track 


-- Credits to AboveAverageDev for helping with improving the code.
local function mine()
	local player = game.Players:GetPlayerFromCharacter(tool.Parent)
	local char = player.Character
	local animator = char:WaitForChild("Humanoid"):WaitForChild("Animator")

	track = animator:LoadAnimation(anim)
    track.Priority = Enum.AnimationPriority.Action

	if not track.IsPlaying and not tool.Mining.Value then
       tool.Mining.Value = not tool.Mining.Value
       track:Play()
    end

	tool.Mining.Value = true

    track.Stopped:Connect(function()
	   tool.Mining.Value = not tool.Mining.Value
    end)
end

tool.Unequipped:Connect(function()
      if track then
         track:Stop()
      end
end)
tool.Activated:Connect(mine)

Create an animation instance inside the tool and put the animationID property of it as your animation id.

Put the animation name as your animation name and the animation id as your animation id. Put this code inside the script inside the tool, i hope you know about the waitTime already.

Mark this as a solution if it worked for ya :smiley:

Wouldn’t work. If the animation is already in the tool, nothing will play.

I edited it, just realized my mistake.

Ok thank you so where would i store the animation? Inside the tool so the script can find it or outsude the tool?

I mean ig it will work but you are loading the animation to the animator every single time you mine. (I’m afraid it might cause a memory leak but we will have to see about that)