Why doesn't it play the animation?

In the past maybe it was not accepted my moderation because i don`t know?

1 Like

No it was accepted i don`t know what is the error?

1 Like

are you making this game under a group or ?

1 Like

under a group and the animation is also under a group so idk

1 Like

Hmmmm you should check a bit more animations under accounts and groups even i don’t know im still trying to make the script.

1 Like

Okay so its getting late for me and I’m not understanding my self at this time I’m going to go. Sorry that I couldn’t help ill check tomorrow if somebody hasn’t found the answer yet. This probably is easy but at this time of the day my brains usually works not today. Good luck!

All right, have a nice sleep :smiley:

1 Like

the line 23 error is due to humanoid not always existing. you need to check if humanoid even exists prior to attempting to do an if statement with it. i recommend just going

if not humanoid then return end

as for the animation, a couple things

  1. you should not be loading a new animation track every single time they click
  2. your top variables should be also localized
  3. you have two waitforchild’s that may not be finding what you want them to find, like the animation or humanoid.
  4. (SOLUTION) you must load the animation into the Animator inside the humanoid, not the humanoid itself. humanoid:LoadAnimation() is deprecated and will create an animator regardless, which occurs when your avatar loads in, so to add more animations that will replicate and play properly, you must do :LoadAnimation() onto the Animator. Once again, Animator is an object that will be inside the Humanoid. Just do Humanoid.Animator:LoadAnimation()

I know about the animator and I already tried it but it didn’t work I will try your Solution

let me know how it goes, ill be here

tool = script.Parent
debounce = nil 

function Attack() 
	if debounce == nil then
		print("0")
		local anim = tool:WaitForChild("Animation")
		local humanoid = script.Parent.Parent:WaitForChild("Humanoid")
		local animTrack = humanoid.Animator:LoadAnimation(anim)

		animTrack:Play()
		debounce = true
		wait(3)
		debounce = nil
	end

end

tool.Activated:Connect(Attack) 

tool.Handle.HitBox.Touched:Connect(function(hit)
	local humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid.Parent ~= tool.Parent and debounce == true then
		print("1")
		humanoid.Health -= 3
	end
end)

wait it just hit me are you using a server script

also, ensure Tool.ManualActivationOnly in its properties is set to false. also ensure its State is set to enabled

What is the state and ManualActivation is set to false!

Tool.State is also a property of Tool

also, to test, change your :WaitForChild()'s to FindFirstChild()'s in your Attack function, see what happens if you get any errors

Tool.State I can`t found it also there is no documentation about it?

its at the bottom of Tool’s properties, just look at it with your property window

Found it, it is enabled, still doesn’t work I think!

What ActionPriority did you use? Is the Animation really RigType Matching up with the Character Rig Type?

It`s R15 just like my character is and my game is even on R15 so I do not get it and also I made other scripts in the game and that animations worked fine idk this is really weird!