--Players the animation by name for the tool holder.

function AnimationPlayer:PlayAnimation(AnimationName)
	local Character = Tool.Parent
	if Character then
		local Humanoid = Character:FindFirstChildOfClass("Humanoid")
		if Humanoid then
			local AnimationGroup = Animationids[AnimationName]
			if AnimationGroup then
				local Animationid = AnimationGroup[Humanoid.RigType]
				if Animationid then
					local LoadedAnimation = Humanoid:LoadAnimation(GetAnimation(Animationid))
					local AnimationData = AnimationSettings[AnimationName] or {}
					LoadedAnimation:Play(AnimationData.FadeTime,AnimationData.Weight,AnimationData.Speed)
					
					return LoadedAnimation
				end
			else
				warn("Missing animation name: "..tostring(AnimationName))
			end
		end
	end
end

return AnimationPlayer
