My animation won't load

I have a spear and an animation but the animation won’t work. I have the Animation priority set to action and the owner set to my group (because it is a group game). But it won’t work. Here is code

local CanSwing = true
local CanDmg = true
function use ()
	local Master = script.Parent.Parent
	print("g")
	if CanSwing == true then 
		print( "load")
		Master.Humanoid:LoadAnimation(script.Parent.Animation)
		CanSwing = false
	
		
		
		local	function touch (hit)
			
			if hit.Parent:FindFirstChild("Humanoid") and CanDmg == true  and CanSwing == false and hit.Parent.TeamColor.Value ~= Master.TeamColor.Value then
			
					
			local text = hit.Parent.Head.HealthBar.BillboardGui.TextLabel
				text.Text = "- "..script.Parent.Damage.Value
			text.Visible = true
				hit.Parent.Humanoid:TakeDamage(script.Parent.Damage.Value)
				CanDmg = false
				wait(script.Parent.Reload.Value)
				text.Visible = false
				CanDmg = true
		end
		end
		
		script.Parent.Part.Touched:Connect(touch)
		
	end
	
	wait(script.Parent.Reload.Value)
	CanSwing = true
	
	end
script.Parent.Activated:Connect(use)

no errors. Prints load so I have no idea what is wrong.

You need to call :Play() to play the animation, that just load it on the humanoid, you want to run that at the top of your code and assign a variable to it

1 Like